Using IF with AND
Using IF with AND
Examples
Following are examples of some common nested
IF(AND()), IF(OR()) and IF(NOT()) statements in Excel.
The AND and OR functions can support up to 255
individual conditions, but it’s not good practice to
use more than a few because complex, nested
formulas can get very difficult to build, test and
maintain. The NOT function only takes one condition.
Here are the formulas spelled out according to their
logic:
Formula Descriptio
n
=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,F If A3
ALSE) (“Blue”) =
“Red”,
AND B3
Formula Descriptio
n
(“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,
Formula Descriptio
n
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,FAL IF A5
SE) (“Blue”)
equals
“Red”, OR
B5
(“Green”)
Formula Descriptio
n
equals
“Green”
then
return
TRUE,
otherwise
return
FALSE. In
this case,
the
second
argument
is True, so
the
formula
returns
TRUE.
=IF(NOT(A6>50),TRUE,FALSE) IF A6 (25)
is NOT
greater
than 50,
then
return
TRUE,
Formula Descriptio
n
otherwise
return
FALSE. In
this case
25 is not
greater
than 50,
so the
formula
returns
TRUE.