CoreGPT
Microsoft 36512 min read

Excel IF Function With Multiple Conditions: 12 Formulas to Copy (AND, OR, Nested IF, IFS)

Twelve copy-ready IF formulas for multiple conditions, all worked on one small sample table with the result for every row: IF AND, IF OR, nested IF, IFS, between two values, blank cells, whole columns, plus the errors people hit and what works in older Excel and Google Sheets.

Excel IF Function With Multiple Conditions: 12 Formulas to Copy (AND, OR, Nested IF, IFS)

To use the Excel IF function with multiple conditions, put AND or OR inside the test. =IF(AND(C2>=D2,E2>=2),"Bonus","No bonus") returns Bonus only when both conditions are true. =IF(OR(C2<30000,E2<2),"Review","OK") returns Review when at least one is true. For more than two outcomes, nest one IF inside another or use IFS.

Every formula below runs on the same six-row table and shows the result for each row, so you can copy one, change the cell references and check it against your own data.

Excel IF function with multiple conditions: which formula to use

SituationFormula to copy
All conditions must be true=IF(AND(C2>=D2,E2>=2),"Bonus","No bonus")
At least one condition is true=IF(OR(C2<30000,E2<2),"Review","OK")
AND and OR together=IF(AND(C2>=D2,OR(B2="East",E2>=3)),"Bonus","No bonus")
A value between two numbers=IF(AND(C2>=35000,C2<=50000),"In range","Out of range")
More than two outcomes, any Excel version=IF(C2>=60000,"Gold",IF(C2>=45000,"Silver",IF(C2>=35000,"Bronze","None")))
More than two outcomes, Excel 2019 and later=IFS(C2>=60000,"Gold",C2>=45000,"Silver",C2>=35000,"Bronze",TRUE,"None")
Count or sum rows that meet several conditions=COUNTIFS(B2:B7,"East",C2:C7,">=50000")

If your rule doesn't match any of these, describe it in plain words in our free Excel formula generator and it writes the formula for you.

The sample table used in every example

A small sales team in A1:E7. Sales and Target are numbers formatted as currency, and Years is how long each rep has been with the company.

ABCDE
1RepRegionSalesTargetYears
2AnnaEast$52,000$45,0004
3BenWest$38,500$40,0003
4CarlaEast$61,200$60,0001
5DavidNorth$29,900$35,0006
6ElenaWest$47,300$40,0002
7FaridNorth$44,000$50,0005

Type each formula in F2, press Enter, then double-click the fill handle (the small square in the bottom-right corner of the cell) to copy it down to row 7. The results are listed in row order, Anna to Farid.

Start with a basic IF statement in Excel

An IF statement in Excel has three parts: a test, the value to return when the test is true, and the value to return when it's false.

=IF(logical_test, value_if_true, [value_if_false])

1. One condition

=IF(C2>=D2,"Met","Missed")

Results: Met, Missed, Met, Missed, Met, Missed.

Text results go in straight double quotes. Numbers, cell references and TRUE/FALSE don't. Everything that follows is this same formula with a smarter test or a smarter result.

IF AND, IF OR and both together

2. IF AND: every condition must be true

A rep gets a bonus only if sales reached the target and they have been on the team at least 2 years.

=IF(AND(C2>=D2,E2>=2),"Bonus","No bonus")

Results: Bonus, No bonus, No bonus, No bonus, Bonus, No bonus.

Carla beat her target but has only 1 year, so the second condition fails and AND returns FALSE. Add more conditions by adding more arguments: AND(C2>=D2,E2>=2,B2="East").

3. IF OR: at least one condition is true

Flag a rep for review if sales are under $30,000 or they have less than 2 years of experience.

=IF(OR(C2<30000,E2<2),"Review","OK")

Results: OK, OK, Review, Review, OK, OK.

Carla is flagged for her 1 year, David for his $29,900. One true condition is enough.

To test one cell against several allowed values, repeat the comparison inside OR:

=IF(OR(B2="East",B2="West"),"Coastal","Inland")

Results: Coastal, Coastal, Coastal, Inland, Coastal, Inland. In Excel you can shorten the test to OR(B2={"East","West"}).

4. AND and OR in the same formula

Bonus if the target was met, and the rep is either in the East region or has 3 or more years.

=IF(AND(C2>=D2,OR(B2="East",E2>=3)),"Bonus","No bonus")

Results: Bonus, No bonus, Bonus, No bonus, No bonus, No bonus.

Elena met her target, but she is in West with 2 years, so the inner OR is FALSE. Read these formulas from the inside out: solve the OR first, then the AND.

5. Between two values

Excel has no "between" operator, so use two comparisons inside AND.

=IF(AND(C2>=35000,C2<=50000),"In range","Out of range")

Results: Out of range, In range, Out of range, Out of range, In range, In range.

Don't write 35000<=C2<=50000. Excel accepts it, but it doesn't mean what it does in math, and every row comes back "Out of range".

Nested IF and IFS: more than two outcomes

6. Nested IF

When there are three or more possible results, put another IF where the "false" value would go. Here sales decide a tier: $60,000 or more is Gold, $45,000 or more is Silver, $35,000 or more is Bronze.

=IF(C2>=60000,"Gold",IF(C2>=45000,"Silver",IF(C2>=35000,"Bronze","None")))

Results: Silver, Bronze, Gold, None, Silver, Bronze.

Excel worksheet with the sales table in A1:E7 and the nested IF formula =IF(C2>=60000,"Gold",IF(C2>=45000,"Silver",IF(C2>=35000,"Bronze","None"))) in F2, filled down to show the tiers Silver, Bronze, Gold, None, Silver and Bronze

Excel checks the conditions from left to right and stops at the first one that is true, so order matters. With >=, start from the highest number. If you test C2>=35000 first, everyone above $35,000 becomes Bronze and the Gold and Silver tests are never reached.

Excel allows up to 64 nested IFs, but anything past three or four is hard to read and easy to break. For longer rules, use IFS or a lookup table (formulas 7 and 8), or let the Excel formula generator build the nesting from a description.

7. IFS: the same tiers without the nesting

=IFS(C2>=60000,"Gold",C2>=45000,"Silver",C2>=35000,"Bronze",TRUE,"None")

Results: Silver, Bronze, Gold, None, Silver, Bronze.

IFS takes pairs of test and result, and returns the result for the first test that is true. It has no "otherwise" argument, so the last pair TRUE,"None" works as the catch-all. Leave it out and David's row shows #N/A.

8. A lookup table instead of a long nested IF

If the tiers might change, keep them in cells instead of inside the formula. Put the minimum for each tier in H2:I5:

HI
1Minimum salesTier
20None
335000Bronze
445000Silver
560000Gold
=XLOOKUP(C2,$H$2:$H$5,$I$2:$I$5,,-1)
=VLOOKUP(C2,$H$2:$I$5,2,TRUE)

Results (both): Silver, Bronze, Gold, None, Silver, Bronze.

Both return the tier for the largest minimum that is less than or equal to the sales figure. XLOOKUP needs Microsoft 365 or Excel 2021 or later. VLOOKUP works everywhere, but the table must be sorted from smallest to largest. More on the difference in XLOOKUP vs VLOOKUP.

More IF formulas with multiple conditions

9. Return a calculation instead of text

Pay 5% commission when the target is met and the rep has 2 or more years, 3% when only the target is met, and nothing otherwise.

=IF(AND(C2>=D2,E2>=2),C2*5%,IF(C2>=D2,C2*3%,0))

Results: 2,600, 0, 1,836, 0, 2,365, 0.

10. Handle blank cells first

Excel treats an empty cell as 0 in a comparison. If you fill formula 1 down past the data, an empty row shows "Met", because 0 is greater than or equal to 0. Check for the blank before anything else:

=IF(C2="","",IF(C2>=D2,"Met","Missed"))

Results: Met, Missed, Met, Missed, Met, Missed, and an empty cell for any row without a sales figure.

11. A whole column in one formula

In Microsoft 365 and Excel 2021 or later, one formula can return all six results at once. AND and OR can't be used for this, because they squeeze the whole range into a single TRUE or FALSE. Multiply the conditions for AND, add them for OR:

=IF((C2:C7>=D2:D7)*(E2:E7>=2),"Bonus","No bonus")
=IF((C2:C7<30000)+(E2:E7<2),"Review","OK")

Results: the same as formulas 2 and 3, spilled into F2:F7 from one cell. Keep each condition in its own parentheses.

12. Count or sum with multiple conditions

When you want a total instead of a label on every row, skip IF and use the functions built for conditions.

=COUNTIFS(B2:B7,"East",C2:C7,">=50000")
=SUMIFS(C2:C7,B2:B7,"West",E2:E7,">=2")

Results: 2 (Anna and Carla are in East with sales of $50,000 or more) and 85,800 (Ben's $38,500 plus Elena's $47,300).

All conditions in COUNTIFS, SUMIFS and AVERAGEIFS are joined with AND. To color the matching rows instead of labeling them, use the same tests in a conditional formatting rule.

IF formula errors and how to fix them

What you seeMost likely causeFix
#NAME?Text without quotes, curly quotes pasted from a web page or document, a misspelled function, or IFS in Excel 2016 or olderRetype the quotes as straight ", check the spelling, use nested IF in old versions
#N/A from IFSNo test was trueAdd TRUE,"your default" as the last pair
#VALUE!A calculation such as C2*5% hit a cell that contains textFix the cell, or test it first with ISNUMBER(C2)
"You've entered too few arguments for this function"The parenthesis that closes AND or OR is in the wrong placeClose it right after the last condition: AND(C2>=D2,E2>=2)
"There's a problem with this formula" on a correct formulaYour regional settings use ; between argumentsReplace the commas with semicolons
FALSE in the cellThe third argument is missingAdd it, or "" for an empty result
Every row gets the same tierNested IF or IFS tests are in the wrong orderWith >=, test the highest number first
The condition is always true or always falseNumbers stored as text, or a number typed in quotes such as C2>="45000"Remove the quotes, and convert the cells with Convert to Number

Three of these deserve a closer look, because Excel shows no error and the results just look wrong:

  • Numbers stored as text. Excel treats any text as larger than any number, so a "52000" stored as text passes every >= test. Look for the small green triangle in the cell's corner, select the cells, click the warning icon and choose Convert to Number.
  • Extra spaces and case. B2="East" matches "east" and "EAST" because = ignores case, but it doesn't match "East " with a trailing space. Clean the column with TRIM, and use EXACT(B2,"East") when case has to match.
  • Wildcards. B2="Nor*" looks for the literal text Nor*, asterisk included. For "contains" tests use =IF(ISNUMBER(SEARCH("Nor",B2)),"Yes","No").

Excel 365 vs older versions, and Google Sheets

Function or featureMicrosoft 365, Excel 2021, 2024, webExcel 2019Excel 2016 and olderGoogle Sheets
IF, AND, OR, NOTYesYesYesYes
COUNTIFS, SUMIFS, AVERAGEIFSYesYesYesYes
IFSYesYesNo, shows #NAME?Yes
XLOOKUPYesNoNoYes
Whole-column formulas that spill (formula 11)YesNoNoWrap in ARRAYFORMULA

If the file will be opened in Excel 2016 or older, stay with nested IF and VLOOKUP. Formulas 1 to 6, 9, 10 and 12 work in every version since Excel 2007.

In Google Sheets, formulas 1 to 10 and 12 work as written, including IFS, which also returns #N/A when no condition is true. Use the long OR(B2="East",B2="West") form there, and write formula 11 as =ARRAYFORMULA(IF((C2:C7>=D2:D7)*(E2:E7>=2),"Bonus","No bonus")).

In both apps, the separator between arguments follows your regional settings. Where the comma is the decimal separator, formulas use semicolons: =IF(AND(C2>=D2;E2>=2);"Bonus";"No bonus").

Frequently Asked Questions

How many conditions can an IF function have? AND and OR accept up to 255 conditions each, you can nest up to 64 IF functions, and IFS takes up to 127 pairs of test and result. In practice, a formula with more than four or five conditions is easier to maintain as a lookup table.

How do I write an IF statement with 3 conditions? If all three must be true for one result, put them in one AND: =IF(AND(C2>=D2,E2>=2,B2="East"),"Yes","No"). If the three conditions lead to different results, nest the IFs or use IFS, as in formulas 6 and 7.

What is the difference between IF AND and nested IF? IF with AND or OR combines several tests into one yes-or-no answer, so there are two possible results. A nested IF checks tests one after another and can return a different result for each, so use it when there are three or more outcomes.

Is IFS better than nested IF? It's shorter and easier to read, with no pile of closing parentheses. Nested IF still wins when the workbook has to open in Excel 2016 or older, where IFS doesn't exist.

Can I use IF with dates and multiple conditions? Yes. Build the dates with DATE instead of typing them as text: =IF(AND(A2>=DATE(2026,1,1),A2<=DATE(2026,12,31)),"This year","Other").

Why does my IF formula return FALSE instead of a blank? The value_if_false argument is missing, so Excel returns the logical value FALSE. End the formula with "" to show an empty cell: =IF(C2>=D2,"Met","").

Describe the rule and let AI write the IF formula

Most IF mistakes come from small things: a parenthesis in the wrong place, tiers in the wrong order, a missing catch-all. CoreGPT for Excel lets you type the rule the way you would say it, for example "in column E, show whether each rep is above or below target", then writes the formula, fills it down the column and explains what it does. It's free to start and works in Excel for Windows, Mac and the web.

Try it: CoreGPT for Excel

Related reading:

Free AI tools

Keep reading

Microsoft 365

How to Insert a Checkbox in Excel (and Count the Checked Boxes)

Add checkboxes to cells with Insert → Checkbox in Microsoft 365, or with Developer → Form Controls in older Excel, then count ticked boxes, show progress, cross out finished rows and delete checkboxes you no longer need.

Read more