Blog / Formulas
How to use IF with multiple conditions in Excel
4 November 2026 ยท 6 min read
Test two or more conditions in Excel with AND, OR, nested IF and IFS, including text tests, with worked examples and common mistakes.
A basic IF formula answers one question: is this true or false? Real spreadsheets ask more. A student passes only if they scored 50 or more and attended. An order gets a discount if it is a member's order or over 500. A grade needs three outcomes, not two. Excel handles all of these with IF plus one of four tools: AND, OR, a nested IF, or IFS.
This guide shows when to use each one, gives worked examples you can type in yourself, and covers the mistakes that make a formula return the wrong answer without any error message.
IF recap
IF checks a test and returns one of two results. It takes three arguments: the test, the result when the test is TRUE, and the result when it is FALSE.
=IF(B2>=50,"Pass","Fail") returns "Pass" when B2 is 50 or more, and "Fail" otherwise. Text results go in double quotes. Numbers do not need quotes.
The test is any comparison that evaluates to TRUE or FALSE: >=, <, =, <> and so on. The comparison operators guide covers them in detail.
Two conditions that must both be true: AND
Use AND when every condition has to be met. AND returns TRUE only if all its tests are TRUE, and FALSE if any one is FALSE.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Student | Score | Attended | Result |
| 2 | Ana | 85 | Yes | Credit |
| 3 |
Result: Credit. Ana's score is 50 or more and she attended, so both tests are TRUE.
Put each condition inside AND, separated by commas, and put the whole AND inside IF as the test. If Ana had not attended, AND would return FALSE and the formula would return "None".
Either condition is enough: OR
Use OR when one condition is enough. OR returns TRUE if at least one of its tests is TRUE, and FALSE only when all of them are FALSE.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Student | Score | Attended | Result |
| 2 | ||||
| 3 | Ben | 62 | Yes | Credit |
| 4 |
Result: Credit. Ben's score is below 80, but the attendance test is TRUE, so OR is TRUE.
A useful way to choose: if the wording in your rule says "and", use AND. If it says "or", use OR. If it says "unless" or "except", you usually want NOT or a reversed test.
Three or more outcomes: nested IF
One IF gives two results. For a third result, put a second IF in the value_if_false part of the first one. Excel tests the outer condition first, and only moves to the inner IF when that test fails:
=IF(B2>=80,"Distinction",IF(B2>=50,"Pass","Fail"))
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Student | Score | Grade | ||
| 2 | Ben | 62 | Pass | ||
| 3 |
Result: Pass. 62 is not 80 or more, so Excel moves to the inner IF, and 62 is 50 or more.
The order of the tests matters. If you test for 50 first, every score of 50 or more matches the first test, and 85 returns "Pass" instead of "Distinction". Always start with the strictest condition.
Each IF needs its own closing bracket. A formula with two IFs ends with two brackets, and a missing one is the most common reason a nested formula will not work.
IFS: the cleaner option for many outcomes
IFS does the same job as nested IF without the brackets. You write each test followed by its result, and IFS returns the result for the first test that is TRUE:
=IFS(test1, value1, test2, value2, ..., TRUE, default)
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Student | Score | Grade | ||
| 2 | Dee | 72 | B | ||
| 3 |
Result: B. 72 is not 80 or more, but it is 60 or more. TRUE at the end catches every other score.
Finish every IFS with TRUE and a result. Without it, a value that matches none of the tests returns #N/A. Microsoft's IFS page lists it for Excel 2019, Excel 2021, Excel 2024 and Microsoft 365, so it will not work in Excel 2016 or earlier. In those versions, use nested IF.
For tests that compare one value with a list of exact matches, such as codes, SWITCH is another option, but it only matches exact values. Use IFS when your tests are ranges like "60 or more".
Mixing AND, OR and IF
You can nest AND and OR inside IF, and inside each other. Brackets show which tests belong together:
=IF(AND(B2>=50,OR(C2="Yes",D2="Yes")),"Credit","None")
This reads: the score must be 50 or more, and either attendance or the coursework flag must be "Yes". Write it in stages, checking each part in its own cell first, and join the parts when each one gives the answer you expect.
Text and number tests
Text tests need the text in double quotes, and the comparison is an equals sign: C2="Yes". Without quotes, Excel looks for a cell or name called Yes and returns an error.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Customer | Sales | Member | Discount |
| 2 | Jordan | 1500 | Yes | 10% off |
| 3 |
Result: 10% off. Both tests are TRUE: sales are 1,000 or more, and the customer is a member.
Numbers are not put in quotes in a test, so B2>=1000 is written without them. Results can be numbers too: =IF(C2="Yes",B2*0.1,0) returns a 10% amount for members and 0 for everyone else.
Common mistakes
- Testing in the wrong order. In a nested IF or IFS, the first TRUE test wins. Put the strictest test first.
- Missing quotes around text.
=IF(C2=Yes,...)returns #NAME?. WriteC2="Yes". - Using OR where you mean AND.
B2>=50 OR C2="Yes"passes a student who did not attend. Read the rule aloud and check the word. - Missing brackets. Every IF, AND and OR needs its own closing bracket. Count them before you give up on a formula.
- No default in IFS. Without a final
TRUE, unmatched values show #N/A. - Overlapping ranges. If one test is "50 or more" and a later test is "70 or more", a score of 75 matches the first test, so the later one never runs. Check that each test is reached only for the values it should cover.
Frequently asked questions
Can IF check more than two conditions? Yes. Use AND or OR inside one IF for two tests that give two results, nested IF for three or more results, or IFS in Microsoft 365 and Excel 2019 and later.
What is the difference between AND and OR in IF? AND needs every test to be TRUE. OR needs at least one. The AND, OR, NOT and XOR guide shows both with examples.
Why does my nested IF always return the same result? The first test is probably too loose, so it matches everything before the others are checked. Reverse the order so the strictest test comes first.
Can IF return a number instead of text? Yes. Leave the result unquoted, such as =IF(B2>=50,1,0), and Excel returns a number.
Does IFS work in Excel 2016? No. IFS needs Excel 2019 or later, so use nested IF in older versions.
Practice with multiple conditions
Reading the formulas is useful, but they only stick once you have built them yourself and seen the result change as you change the inputs. Our nested IF lesson gives you a list of scores to grade with two IFs, and checks each answer instantly. If you want to practice AND and OR first, the Decisions with IF, AND and OR lesson is the place to start. For the details of each function, see the guides to IF, IFS and AND, OR, NOT and XOR.
Practise it: Nested IF
Type the formulas yourself in a real spreadsheet, with instant feedback on every answer. Your first five lessons are free.