MrExcel Publishing
Your One Stop for Excel Tips & Solutions

IF stmt


Posted by mcarter973 on May 07, 2001 8:40 AM

Is there a way to include multiple "IF" statements w/i an argument (where both conditions have to be met)?
For example, I want to say IF A = x and IF B = y then do C + D.

Thanks


Posted by Kevin James on May 07, 2001 9:16 AM

Mcarter973:

=if(and(A=x,B=y),C+D,)

You didn't indicate a false part of the equation. That would go: ... ,C+D,[here])

Kevin

Posted by IML on May 07, 2001 9:19 AM

You bet. The format would be

=IF(AND(A=x,b=y),c+d,do something else)

=IF(AND(A1=1,B1=2),"yes","no")
would return the value "yes" if both conditions are true. If one is false, it would return "no"