ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Logic
  3. Use AND and OR Together in One IF Formula

Use AND and OR Together in One IF Formula

By ExcelReady Team·Updated November 2, 2026·6 min read

The short answer

To use AND and OR together in IF, nest one inside the other. =IF(AND(C2>=50000,OR(B2="North",B2="South")),"Bonus","No") needs sales of 50,000 or more and a region of North or South. =IF(OR(C2>=60000,AND(D2>=5,C2>=45000)),"Review","") passes if the first test is true, or if both inner tests are true. Each inner function is worked out first.

Key takeaways

  • Put OR inside AND when one condition is fixed and the other has a choice of values.
  • Put AND inside OR when there are two or more separate ways to pass.
  • Every comparison must be complete: OR(B2="North",B2="South"), not OR(B2="North","South").
  • Read the formula out loud with "and" and "or" in place of the brackets to check the logic.
  • For counts, add one COUNTIFS per OR option, or use SUMPRODUCT.
On this page+
  1. How AND and OR work together
  2. How to put OR inside AND
  3. How to put AND inside OR
  4. How to check the brackets and the logic
  5. How to count rows that meet AND and OR conditions
  6. When to use IFS or nested IF instead
  7. Common mistakes with IF, AND and OR together
  8. Practise it

You can use IF with AND and OR together by putting one function inside the other. AND(test1, OR(test2, test3)) means "test1 must be true, plus either test2 or test3". OR(test1, AND(test2, test3)) means "pass on test1 alone, or on test2 and test3 together". This guide is for anyone whose rules mix "and" with "or", such as bonus, discount or approval checks, and it builds both patterns on one small table.

How AND and OR work together#

AND returns TRUE only when every test inside it is true. OR returns TRUE when at least one test is true. When you nest one inside the other, Excel works out the inner function first, and its TRUE or FALSE becomes a single test for the outer function. IF then turns that final TRUE or FALSE into the result you want.

All examples use this sales table in A1:D7:

ABCD
1NameRegionSalesYears
2AishaNorth62,0003
3BenSouth48,0006
4CarlaEast71,0001
5DmitriNorth39,0008
6ElenaWest55,0004
7FemiSouth58,0002

If AND and OR are new to you, start with IF with AND and IF with OR separately, then come back here.

How to put OR inside AND#

Put OR inside AND when one rule is fixed and another rule has a choice of values. The rule: a bonus needs sales of 50,000 or more, and the region must be North or South. In E2, type:

Excel formula
=IF(AND(C2>=50000,OR(B2="North",B2="South")),"Bonus","No")

Here is how Excel reads row 2:

  1. C2>=50000: 62,000 is at least 50,000, so TRUE.
  2. OR(B2="North",B2="South"): the region is North, so TRUE.
  3. AND(TRUE,TRUE) is TRUE, so IF returns Bonus.

Fill down to E7 (Windows: Ctrl+D; Mac: ⌘D). Only Aisha and Femi get Bonus. Carla has high sales but is in East, so OR fails. Ben is in South but sold under 50,000, so the sales test fails.

When OR checks one cell against several text values, there's a shorter form: OR(B2={"North","South"}). It works in every version and gives the same result.

How to put AND inside OR#

Put AND inside OR when there are two or more separate ways to pass, and at least one of them has two parts. The rule: flag for senior review if sales are 60,000 or more, or if the person has 5 or more years and at least 45,000 in sales.

Excel formula
=IF(OR(C2>=60000,AND(D2>=5,C2>=45000)),"Review","")

Aisha (62,000) and Carla (71,000) pass on sales alone. Ben passes the second way: 6 years and 48,000. Dmitri has 8 years but only 39,000, so his AND is FALSE, and he is not flagged. The result is Review for 3 people.

Use "" as the last argument when you want the cell to look empty if the test fails.

How to check the brackets and the logic#

The safest way to write these formulas is to read them out loud, saying "and" or "or" for each function. The bonus formula reads: "sales at least 50,000 and (North or South)". If that sentence matches your rule, the formula is right.

Then check the brackets:

  • Each function opens and closes its own bracket: OR( … ) closes before AND continues.
  • Excel colours matching brackets as you type, which helps you spot a missing one.
  • Moving a bracket changes the meaning. OR(AND(C2>=50000,B2="North"),B2="South") means "50,000 and North, or any South row", so Ben would pass even with 48,000.

If a rule has many parts, split it into helper columns: one column for the region test and one for the sales test, then a final =IF(AND(F2,G2),"Bonus","No"). It's longer but much easier to check. The IF function guide explains the three IF arguments.

How to count rows that meet AND and OR conditions#

To count the people who get a bonus without a helper column, add one COUNTIFS for each OR option. COUNTIFS uses AND logic inside, so each one checks sales and one region:

Excel formula
=COUNTIFS(C2:C7,">=50000",B2:B7,"North")+COUNTIFS(C2:C7,">=50000",B2:B7,"South")

The result is 2 (Aisha and Femi). This works because no row can be in both regions, so nobody is counted twice.

For more complex mixes, SUMPRODUCT can multiply tests (AND) and add them (OR):

Excel formula
=SUMPRODUCT((C2:C7>=50000)*((B2:B7="North")+(B2:B7="South")))

This also returns 2. In this style, * acts as AND and + acts as OR.

When to use IFS or nested IF instead#

AND and OR give you one TRUE or FALSE, so IF can only return two results. When you need three or more outcomes, put each AND/OR test into IFS (Excel 2019, 2021 and Microsoft 365):

Excel formula
=IFS(AND(C2>=50000,OR(B2="North",B2="South")),"Bonus",C2>=50000,"Review",TRUE,"No")

Aisha and Femi get Bonus, Carla and Elena get Review (high sales, wrong region), and the rest get No. IFS checks tests in order and stops at the first TRUE, so put the strictest rule first. The guide to IF with multiple conditions compares nested IF, IFS and lookup tables. For range checks such as "between 40,000 and 60,000", see IF between two numbers.

Common mistakes with IF, AND and OR together#

These slips cause most wrong results:

  1. Half-written comparisons. OR(B2="North","South") returns #VALUE!, because "South" on its own is not TRUE or FALSE. Write B2="South".
  2. Brackets in the wrong place. Read the formula out loud to check which tests belong together.
  3. Quotes around numbers. C2>="50000" compares a number with text, and Excel ranks any text above any number, so the test is always FALSE. Leave numbers unquoted.
  4. Spaces in text data. "North " with a trailing space doesn't equal "North". Clean the column with TRIM.
  5. Blank cells. An empty Sales cell counts as 0, so it fails C2>=50000 quietly. If blanks need their own result, test them first; see IF blank in Excel.

The AND function guide and OR function guide list the full rules, including how they treat empty cells.

Practise it#

Try the exercise on this page: it needs OR inside AND inside IF. Then practise AND, OR and NOT in a live spreadsheet, where you combine conditions inside IF step by step, and review the basics in the IF function lesson. Your formula is checked as soon as you press Enter.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Aisha gets a bonus if her Sales (C2) are 50,000 or more and her Region (B2) is North or South. In E2, write an IF formula that returns Bonus or No.

fx
ABCDEF
1
Name
Region
Sales
Years
Bonus?
2
Aisha
North
62000
3
3
Ben
South
48000
6
4
Carla
East
71000
1
5
Dmitri
North
39000
8
6
Elena
West
55000
4
7
Femi
South
58000
2
8
9
10

Tip: The test is AND(sales test, OR(region test 1, region test 2)). Wrap it in IF with "Bonus" and "No".

Practise this in a lesson

LessonAND, OR and NOTCheck several conditions at once with AND and OR, flip a result with NOT, and combine them inside IF.LessonThe IF functionMake a cell show one result or another depending on a condition, like Pass/Fail or Over/Under budget.Function guideIFLearn Excel's IF function with practical examples: flag budgets, label rows and return blanks. Avoid the classic mistakes and practice live.Function guideANDCheck that every condition is true with Excel's AND. Use it inside IF for bonuses, ranges and eligibility rules, then try a live exercise.Function guideORReturn TRUE when any condition is met with Excel's OR. Flag tickets, match one of several values and combine OR with IF. Practice it live.

Frequently asked questions

Can you use AND and OR together in Excel?

+

Yes. Nest one inside the other, for example =IF(AND(C2>=50000,OR(B2="North",B2="South")),"Bonus","No"). The inner function is worked out first and its TRUE or FALSE becomes one test of the outer function.

How do I write IF with AND and OR in one formula?

+

Start with IF, then build the test from AND and OR: =IF(AND(test1,OR(test2,test3)),value_if_true,value_if_false). Close each bracket before the comma that follows it.

What is the difference between AND and OR in Excel?

+

AND returns TRUE only when every test is true. OR returns TRUE when at least one test is true. Both return FALSE otherwise.

How many conditions can AND and OR take?

+

Each accepts up to 255 tests. In practice, more than four or five tests is hard to read, so consider a helper column or IFS.

Why does my IF AND OR formula return #VALUE!?

+

Usually because one of the tests is not a full comparison, such as OR(B2="North","South"). Excel can't treat the text "South" as TRUE or FALSE. Write B2="South" instead.

Sources

  • AND function - Microsoft Support
  • OR function - Microsoft Support
  • IF function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. How AND and OR work together
  2. How to put OR inside AND
  3. How to put AND inside OR
  4. How to check the brackets and the logic
  5. How to count rows that meet AND and OR conditions
  6. When to use IFS or nested IF instead
  7. Common mistakes with IF, AND and OR together
  8. Practise it

Keep reading

Logic· 6 min read

IF with AND in Excel: Check Two Conditions at Once

To check two conditions at once, put AND inside IF: =IF(AND(B2>=80000,C2>=95%),"Bonus","No bonus"). AND returns TRUE only when every condition inside it is true, and IF turns that into the result you choose. You can list up to 255 conditions in AND, separated by commas. If any one is false, IF returns the false result.

Logic· 7 min read

IF Between Two Numbers in Excel

To check if a number is between two values in Excel, combine IF with AND: =IF(AND(B2>=1,B2<=5),"Standard","Other"). AND needs both tests to be true: at least the lower limit and at most the upper limit. Use > and < instead to leave out the limits themselves. Excel has no BETWEEN function, so you always write both tests.

Logic· 6 min read

IF with OR in Excel: Pass When Any Condition Is Met

To pass when any one of several conditions is true, put OR inside IF: =IF(OR(B2="VIP",C2>=500),"Free shipping", "Standard"). OR returns TRUE if at least one condition is true, and FALSE only when all of them are false. IF then shows the result you choose. Each condition must be written in full, even when it tests the same cell.

More on logic

  • IF Cell Is Blank in Excel: Formulas That Work
  • IF Formulas With Dates in Excel: Before, After, Overdue
  • The Excel IF Function Explained Simply
  • IF Greater Than in Excel (and Greater Than or Equal)
  • IF With Multiple Conditions in Excel
  • IF Not Blank in Excel: Formulas That Skip Empty Cells
All logic articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free