Two conditions: AND and OR

A bonus is often given not for one achievement but for two at once. Say the rule is: sales of at least $100,000 and at least five new clients. For now, the formula in D2 checks only the sales, and one manager gets a bonus they shouldn't:

fx
A
B
C
D
E
1
2
3
4
5
6
7
8
Manager
Sales, $
New clients
Bonus
Emma
124000
7
Ben
87500
9
Olivia
100000
5
Leo
99900
6
Mia
143000
3
Sheet1

Two conditions in one check

One comparison checks one condition. To check two at once, you pass them to the AND or OR function, separated by a comma, like the arguments of any function:

=AND(B2>=100000,C2>=5)

Here B2 holds the sales, and C2 the number of new clients from the same row.

  • AND answers TRUE only if all the conditions are true.
  • OR answers TRUE if at least one of them is true.

The difference is easy to see on a single number with two boundaries. A medicine is stored at a temperature from 2 to 8 °C. The temperature is in range if it's no lower than 2 and at the same time no higher than 8. An alert goes off if it's lower than 2 or higher than 8. In the diagram, each condition shades the band where it's true. Move the temperature around, then switch to OR:

=AND(B2>=2,B2<=8)
B2>=2TRUE
B2<=8TRUE
ANDTRUE
Move the slider. Temperature in B2: 5 °C
AND answers TRUE only where both bands are shaded: from 2 to 8 degrees, inclusive.

This is how Excel checks any "between": a temperature from 2 to 8 is written as =AND(B2>=2,B2<=8).

AND inside IF

AND and OR answer TRUE or FALSE, just like a plain comparison. That's why they go into IF in place of the condition:

=IF(AND(B2>=100000,C2>=5),"Bonus","No")

This formula has two pairs of parentheses, one inside the other. In the diagram, matching parentheses have the same color:

=IF(AND(B2>=100000,C2>=5),"Bonus","No")
The parentheses of AND open and close inside the first argument. Only after its closing parenthesis come the comma and the answers of IF.

OR goes in the same place. For the medicine, the alert formula is:

=IF(OR(B2<2,B2>8),"Alert","OK")

All that's left is to fix the bonus table. Right now D2 checks only the sales, so add the condition about clients there:

Add a second condition to D2: at least 5 new clients. Put both comparisons inside AND
fx
A
B
C
D
E
1
2
3
4
5
6
7
8
Manager
Sales, $
New clients
Bonus
Emma
124000
7
Ben
87500
9
Olivia
100000
5
Leo
99900
6
Mia
143000
3
Sheet1
Right now D2 checks only the sales, B2>=100000. The number of new clients is in C2.

AND and OR can hold more than two conditions. If a third one is added to the rules, for example about customer reviews, it goes inside the parentheses as one more argument after a comma.