Using IF with AND/OR functions
The IF function allows you to make a logical comparison between a value and what you
expect by testing for a condition and returning a result if that condition is True or False.
▪ =IF(Something is True, then do something, otherwise do something
else)
But what if you need to test multiple conditions, where let’s say all conditions need to be True or False
(AND), or only one condition needs to be True or False (OR), or if you want to check if a condition
does NOT meet your criteria? All 3 functions can be used on their own, but it’s much more common
to see them paired with IF functions.
When you combine each one of them with an IF statement, they read like this:
▪ AND – =IF(AND(Something is True, Something else is True), Value if
True, Value if False)
▪ OR – =IF(OR(Something is True, Something else is True), Value
if True, Value if False)
Examples
Formula Description
=IF(AND(A2>0,B2<100),TRUE, FALSE) IF A2 (25) is greater than 0, AND B2 (75) is less than
100, then return TRUE, otherwise return FALSE. In
this case both conditions are true, so TRUE is
returned.
=IF(AND(A3="Red",B3="Green"),TRUE,FALSE) If A3 (“Blue”) = “Red”, AND B3 (“Green”) equals
“Green” then return TRUE, otherwise return FALSE. In
this case only the first condition is true, so FALSE is
returned.
=IF(OR(A4>0,B4<50),TRUE, FALSE) IF A4 (25) is greater than 0, OR B4 (75) is less than
50, then return TRUE, otherwise return FALSE. In this
case, only the first condition is TRUE, but since OR
only requires one argument to be true the formula
returns TRUE.
=IF(OR(A5="Red",B5="Green"),TRUE,FALSE) IF A5 (“Blue”) equals “Red”, OR B5 (“Green”) equals
“Green” then return TRUE, otherwise return FALSE. In
this case, the second argument is True, so the
formula returns TRUE.
Note that all of the examples have a closing parenthesis after their respective conditions are entered.
The remaining True/False arguments are then left as part of the outer IF statement. You can also
substitute Text or Numeric values for the TRUE/FALSE values to be returned in the examples.