Excel "if-then" formula [closed]
Solution 1:
Above is my formula to show only positive numbers above 40 in the given cell. If my hours are ...lets say 35, I do not want a value of -5, I want the cell value to be 0. Why is this not working?
I see no reason for that formula to work. Ensure the value stored in B4 is an integer and not a string. It's possible the order of operations is being mis-interpreted: as written, IF(B4-40<0,0,(B4-40))
may be checking if -40 is less than zero; that being said, I doubt this is the case, as the formula should evaluate the arithmetic operation before the comparison. Try adding additional brackets around the B4-40
term (for conciseness more than anything):
=IF( (B4-40) < 0, 0, (B4-40) )
I've verified that both the above formula, as well as the original, do indeed work properly on both MS Excel 2007 under Windows, as well as Gnumeric under Linux.
Solution 2:
You are missing an =
in front of the formula. Without it Excel will interpret it as text.
=IF((B4-40)<0,0,(B4-40))