AND vs OR in Excel: All Conditions or Any
By ExcelReady TeamUpdated 7 min read
The short answer
AND returns TRUE only when every condition is true. OR returns TRUE when at least one condition is true. Use AND for strict rules, like sales of 50,000 or more and a rating of 4 or more. Use OR for "either" rules. Both usually sit inside IF, as in =IF(AND(B2>=50000,C2>=4),"Bonus","No").
Key takeaways
- AND: every condition must be TRUE. OR: at least one condition must be TRUE.
- Both take up to 255 conditions, separated by commas, and return TRUE or FALSE.
- Put them inside IF to return words or numbers instead of TRUE and FALSE.
- Inside FILTER and other array formulas, use * for AND and + for OR; the AND and OR functions return a single value.
On this page+
The short answer to AND vs OR in Excel: AND is TRUE only when all of its conditions are true, and OR is TRUE when any of them is true. AND makes a rule stricter with every condition you add; OR makes it looser. This guide compares them on the same staff data, shows how each works inside IF and FILTER, and covers the mistakes that trip people up in job tests.
AND vs OR at a glance#
Both functions test conditions and return TRUE or FALSE. The difference is how many conditions must pass.
| Feature | AND | OR |
|---|---|---|
| Returns TRUE when | Every condition is TRUE | At least one condition is TRUE |
| Returns FALSE when | Any condition is FALSE | Every condition is FALSE |
| Syntax | =AND(logical1, [logical2], ...) | =OR(logical1, [logical2], ...) |
| Maximum conditions | 255 | 255 |
| Effect of adding a condition | Fewer rows pass | More rows pass |
| Everyday words | "both", "all", "and also" | "either", "any", "at least one" |
| Inside FILTER or array formulas | Use * between conditions | Use + between conditions |
| Excel versions | All versions | All versions |
A condition, also called a logical test, is any expression that gives TRUE or FALSE, such as B2>=50000 or D2="North".
How AND and OR decide: the truth table#
With two conditions, there are only four combinations. This table shows what each function returns:
| Condition 1 | Condition 2 | AND | OR |
|---|---|---|---|
| TRUE | TRUE | TRUE | TRUE |
| TRUE | FALSE | FALSE | TRUE |
| FALSE | TRUE | FALSE | TRUE |
| FALSE | FALSE | FALSE | FALSE |
AND and OR agree only when both conditions are the same. When one is TRUE and the other FALSE, AND says FALSE and OR says TRUE. That middle part of the table is where choosing the wrong function changes your answer. A few details matter when conditions point at cells rather than comparisons:
- Numbers count as logical values. 0 is FALSE and any other number is TRUE, so
=AND(1,5)is TRUE and=OR(0,0)is FALSE. - Empty cells and text in a referenced range are ignored.
=AND(E2:E5)only looks at the TRUE and FALSE values in that range. If the range holds no logical values at all, the result is #VALUE!. - Errors spread. If any condition returns an error, such as #N/A from a lookup, AND and OR return that error too, even when another condition would already decide the answer.
The AND function guide and the OR function guide list the full rules.
The same data, tested both ways#
Here is a list of sales staff:
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Name | Sales | Rating | Region |
| 2 | Amara | 62,000 | 4 | North |
| 3 | Ben | 48,000 | 5 | South |
| 4 | Chloe | 51,000 | 3 | North |
| 5 | Dev | 39,000 | 2 | East |
| 6 | Eva | 75,000 | 5 | West |
| 7 | Femi | 45,000 | 4 | South |
Rule 1 with AND: sales of 50,000 or more and a rating of 4 or more#
=AND(B2>=50000,C2>=4)Filled down, this returns TRUE only for Amara and Eva. Ben has the rating but not the sales. Chloe has the sales but a rating of 3. Two of six people pass.
Rule 2 with OR: sales of 50,000 or more or a rating of 4 or more#
=OR(B2>=50000,C2>=4)Now five people pass: everyone except Dev, who misses both conditions. Same two conditions, very different result.
Turning TRUE and FALSE into labels with IF#
On its own, AND or OR shows TRUE or FALSE. Wrap it in IF to show something more useful:
=IF(AND(B2>=50000,C2>=4),"Bonus","No")
=IF(OR(B2>=50000,C2>=4),"Review","")The first shows Bonus for Amara and Eva. The second marks five people for a review and leaves Dev blank. The guides to the IF AND formula and the IF OR formula have more examples of each pattern.
Counting rows that pass#
COUNTIFS uses AND logic: every condition must match. =COUNTIFS(B2:B7,">=50000",C2:C7,">=4") returns 2. For OR, add two COUNTIFs and subtract the rows counted twice: =COUNTIF(B2:B7,">=50000")+COUNTIF(C2:C7,">=4")-COUNTIFS(B2:B7,">=50000",C2:C7,">=4") gives 3 + 4 − 2 = 5.
When to use AND#
Use AND when every condition is required. Listen for the words "both", "all" and "and also":
- Eligibility rules: a bonus needs high sales and a good rating.
- Ranges between two numbers:
=AND(B2>=40000,B2<=60000)is TRUE when sales are from 40,000 to 60,000. Ben, Chloe and Femi pass. The guide to IF between two numbers covers this in detail. - Data checks: a row is complete only if the name, date and amount are all filled in:
=AND(A2<>"",B2<>"",C2<>""). - Conditional formatting rules: select A2:D7, choose Home > Conditional Formatting > New Rule > Use a formula, and enter
=AND($B2>=50000,$C2>=4)with a green fill. Amara's and Eva's rows light up. The$before B and C keeps every cell in the row checking the same two columns.
When to use OR#
Use OR when any one condition is enough. Listen for "either", "any" and "at least one":
- Several accepted values: a region is in the southern team if it's South or West:
=OR(D2="South",D2="West"). - Warning flags: flag a row if sales are low or the rating is low:
=OR(B2<40000,C2<3)flags only Dev. - Alternative routes: a candidate qualifies with a degree or five years' experience.
- Finding gaps:
=OR(B2="",C2="",D2="")is TRUE when any of the three cells is empty, a quick way to spot incomplete rows before you share a report. It's the mirror image of the AND data check above.
For "one or the other, but not both", use XOR instead. The guide to the XOR function explains how it differs from OR.
Using AND and OR together#
Real rules often mix both. Nest one function inside the other. For example, staff in the North or South region with sales of at least 45,000:
=AND(OR(D2="North",D2="South"),B2>=45000)The OR checks the region, then AND adds the sales condition. Amara, Ben, Chloe and Femi pass: 4 people. Dev and Eva fail the region test.
Read nested formulas from the inside out, and say the rule in words before you type it. "North or South, and at least 45,000" maps directly onto the formula. The guide to AND, OR and NOT adds NOT, which flips TRUE and FALSE, for rules like "any region except East".
Common mistakes with AND and OR#
These are the slips that most often give wrong answers:
- Choosing by the word in the question, not the logic. "Staff in North and South" usually means staff in either region, which is OR. No one is in both regions at once, so AND would return FALSE for everyone.
- Writing the cell once for two tests.
=OR(D2="North","South")doesn't work. Repeat the cell:=OR(D2="North",D2="South"). - Using AND or OR inside FILTER.
=FILTER(A2:A7,AND(B2:B7>=50000,C2:C7>=4))fails, because AND returns one value for the whole range. Use(B2:B7>=50000)*(C2:C7>=4)instead, which returns Amara and Eva. Use+for OR. FILTER needs Excel 2021 or Microsoft 365. - Writing maths-style ranges.
=40000<=B2<=60000doesn't work in Excel. Use=AND(B2>=40000,B2<=60000). - Forgetting quotes around text.
D2=Northgives #NAME?. WriteD2="North".
Our recommendation#
Choose by how many conditions must be true. If all of them must be true, use AND. If any one is enough, use OR. When a rule has both kinds, nest them, and write the rule in plain words first. In FILTER and other array formulas, swap the functions for * (AND) and + (OR). If you're unsure which one a rule needs, test it on a row that meets only one condition, like Ben or Chloe here, and check that the result matches what the rule intends.
In short: AND for all, OR for any.
Practise it#
Try the exercise on this page: an IF with AND that pays a bonus only when both conditions are met. Then practise AND, OR and NOT in a live spreadsheet, where you combine conditions and check your answers instantly.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
The bonus rule is: sales of 50,000 or more AND a rating of 4 or more. In E2, use IF with AND to return Bonus for Amara if she meets both conditions, or No if not.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Region | |||||
| 2 | North | |||||
| 3 | South | |||||
| 4 | North | |||||
| 5 | East | |||||
| 6 | West | |||||
| 7 | South | |||||
| 8 | ||||||
| 9 | ||||||
| 10 |
Tip: The test is AND(B2>=50000,C2>=4). Then give IF the two results in quotes: "Bonus" and "No".
Practise this in a lesson
Frequently asked questions
What is the difference between AND and OR in Excel?
AND returns TRUE only if all its conditions are true. OR returns TRUE if any one of its conditions is true. With conditions A and B, AND needs both, while OR needs either.
Can I use AND and OR together in one formula?
Yes. Nest one inside the other, for example =AND(OR(D2="North",D2="South"),B2>=45000). This is TRUE when the region is North or South and sales are at least 45,000.
How do I use AND and OR with IF?
Put AND or OR as the first argument of IF: =IF(OR(B2>=50000,C2>=4),"Yes","No"). IF then returns Yes when the OR test is TRUE and No when it is FALSE.
Why doesn't AND work inside FILTER?
AND combines every value in a range into one TRUE or FALSE, so FILTER can't use it row by row. Multiply the conditions instead: =FILTER(A2:A7,(B2:B7>=50000)*(C2:C7>=4)). Use + for OR.
How many conditions can AND and OR test?
Up to 255 conditions each. In practice, if you need more than four or five, a helper column or a lookup table is usually easier to read.