If statement help


Posted by david osborne on June 28, 2001 5:56 AM

i made this statement and it will only say over paid or under paid but not even. i am only new to excel and i can not find an answer.
=IF(B32=0,"even",IF(B32>0,"over taxed",IF(B32<0,"under taxed",)))
any help would be great

Thanks.

Posted by JAF on June 28, 2001 6:04 AM

Hiya

I tested your IF Statement on some fairly simple figures and it did return a value of "even" when cell B32 was equal to zero.

I'd guess that cell B32 may be formatted to no decimal places, so appears to contain a value of 0 when it may in fact contain something like 0.1 or -0.1 (or could it be formatted as text??)

A slightly more "elegant" version of the IF statement is as follows:
=IF(B32>0,"over taxed",IF(B32<0,"under taxed","even"))

This states that if B32 is greater than zero then "over taxed" is returned, if B32 is less than zero then return "under taxed" otherwise return "even". This covers all eventualities and should work for you.


JAF

Posted by david osborne on June 28, 2001 6:09 AM

thanks but its reading from a cell with this in it
=IF(B28=0,"0",(SUM(B28-D18))) could that be the problem the cell is set to currency.

Posted by Eric on June 28, 2001 7:06 AM

Try taking the "0" out of quotes, I think it's returning 0 as a string, not a number

Hi, I think asking the IF statement to return something in quotes makes it return an alphanumeric rather than a numeric value. Try taking out the quotes so that it reads
=IF(B28=0,0,(SUM(B28-D18))
and see if your second column starts reading the 0 value correctly



Posted by Ben O. on June 28, 2001 7:09 AM

Don't put parentheses around the zero in your formula. By adding parentheses you're telling Excel that it's a text value.

-Ben