IF statement syntax

S

Sander

What is the proper syntax for a non-nested, two-condition IF statement?

Example: IF(C16<1 & C15>1,-B15).

This syntax appears to work when the two elements of the condition are
simultaneously true. Unfortunately, -B15 is apparently always returned, even
when the two conditions are not simultaneously true. What up? How do I get
this right?

Thanks.
 
J

JoeU2004

Sander said:
Example: IF(C16<1 & C15>1,-B15).

That should be written:

=if(and(C16<1, C15>1), -B15, "")

Note that I added "" to cover the case when the condition is not met. You
might replace "" with something else. But if you omit that part, the IF
function will return FALSE, which is usually undesirable.


----- original message -----
 
J

Jacob Skaria

If true -B15 if false blank

=IF(AND(C16<1,C15>1),-B15,"")

If this post helps click Yes
 
D

David Biddulph

=IF(AND(C16<1,C15>1),-B15,"whatever answer you want if your condition isn't
met")
 
T

T. Valko

Try it like this:

=IF(AND(C16<1,C15>1),-B15,"")

If C16 is an empty cell it will evaluate to be less than 1. If you don't
what that to happen:

=IF(AND(C16<>"",C16<1,C15>1),-B15,"")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top