Using IF With AND
Using IF With AND
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.
When you combine each one of them with an IF statement, they read like this:
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.