How to use IF with multiple conditions in Excel
To use IF with multiple conditions in Excel, put AND or OR inside the first argument of IF. AND needs every condition to be true, and OR needs only one. For more than two outcomes, use IFS or nest one IF inside another. This guide gives a working formula for each case.
1. IF with AND: all conditions must be true
AND returns TRUE only when every condition inside it is true. Put it as the test of IF, and IF picks the first result when all conditions hold, and the second otherwise.
Example: Pass only if both scores reach 50
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Name | Theory | Practice | Result |
| 2 | Ana | 70 | 45 | Fail |
The theory score is enough, but the practice score is 45. One false condition makes AND false.
2. IF with OR: one condition is enough
OR returns TRUE when at least one of its conditions is true. Use it when there are several ways to qualify.
Example: A discount for Gold members or big orders
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Customer | Level | Order | Discount? |
| 2 | Ben | Silver | 1500 | Yes |
Ben is not Gold, but the order is 1,500, which is at least 1,000. One true condition is enough for OR.
3. IFS for more than two outcomes
IFS (Excel 2019 and Microsoft 365) tests condition and result pairs in order and returns the result of the first condition that is true. End with TRUE and a default value, or the formula returns #N/A when nothing matches.
Example: A letter grade from a score
| A | B | C | |
|---|---|---|---|
| 1 | Name | Score | Grade |
| 2 | Cam | 85 | B |
85 is not 90 or more, but it is 80 or more, so the answer is B.
4. Nested IF for older versions
Before IFS, the way to get several outcomes was to put an IF inside the false part of another IF: =IF(B2>=90,"A",IF(B2>=80,"B","C")). It works in every version, but each extra level makes the formula harder to read. Check the strictest condition first, because the first true test wins.
5. Count or add with several conditions instead
When you want a total or a count rather than a label, use COUNTIFS or SUMIFS. They take several condition pairs, so you do not need IF at all.
Common mistakes
Writing a range like 50<=B2<=80. Excel cannot chain comparisons this way and gives the wrong result.
Fix: Use AND: =AND(B2>=50,B2<=80).
Checking a broad condition first. In a nested IF or IFS, a test for >=50 placed before >=90 catches the high scores too.
Fix: Order the tests from the strictest to the loosest.
Forgetting quotes around text. =IF(B2=Gold,...) makes Excel look for a name, and the result is #NAME?.
Fix: Put text in double quotes: B2="Gold".
Frequently asked questions
How many conditions can IF handle?
AND and OR accept up to 255 conditions. A nested IF can go 64 levels deep, but IFS is much easier to read.
Can I combine AND and OR in one formula?
Yes. Nest one inside the other, for example =IF(AND(B2>=50,OR(C2="A",C2="B")),"Yes","No").
What is the difference between IFS and SWITCH?
IFS tests different conditions. SWITCH compares one value with a list of exact matches, which suits codes such as 1, 2 and 3.
Related functions
- IFIF checks a condition and returns one value if it's true and another if it's false.
- ANDAND returns TRUE only when every condition is true.
- OROR returns TRUE when at least one condition is true.
- IFSIFS checks several conditions in order and returns the value for the first one that's true: a cleaner alternative to nested IFs.
- COUNTIFSCOUNTIFS counts the rows that meet several conditions at once, such as a region and an amount range.
- SUMIFSSUMIFS adds up values that meet several conditions at once, such as paid orders from one region.
- SWITCHSWITCH compares one value with a list of options and returns the matching result, with an optional default.
More on multiple conditions
The guide gives IF with AND, OR, IFS and nested IF. This piece adds how to keep long formulas readable, how to mix AND with OR safely, and how to find a rule that fails.
Keep a long formula readable
Press Alt+Enter inside the formula bar to put each condition on its own line. Excel ignores the line breaks, and you can read the logic. Put the conditions that change, such as a limit, in cells and refer to them with locked references. A formula with =IF(B2>=$F$1,"Pass","Fail") is easier to maintain than one with the number 50 inside it.
Mixing AND with OR
Excel does not use operator precedence between AND and OR, because they are functions. You combine them by nesting, and the nesting decides the logic. The first formula below says: the score is at least 50, and the level is A or B. Moving a bracket changes the meaning.
=IF(AND(B2>=50,OR(C2="A",C2="B")),"Yes","No")Find the rule that fails
When a result is not what you expected, test each condition on its own in a spare cell, such as =B2>=50. A TRUE or FALSE shows you which part misbehaves. The usual causes are a number stored as text, a trailing space in a text value, and a text comparison where the capitals differ in a way you do not expect.
Practice in [the IF lesson](/learn/if-function) and [AND, OR and NOT](/learn/and-or-not), then continue to [SWITCH and XOR](/learn/hlookup-switch-xor).