How to Use the IF Function in Excel (with Examples, 2026)
The IF function returns one thing when a condition is true and another when it’s false — the foundation of almost every decision-making formula in Excel. Here’s the syntax, real examples, and how to handle several conditions at once.
IF Syntax
=IF(logical_test, value_if_true, value_if_false)
- logical_test — a condition that evaluates to TRUE or FALSE (e.g.,
B2>100). - value_if_true — what to return when the test is true.
- value_if_false — what to return when it’s false.
Text results go in quotes; numbers and formulas don’t.
1. A Basic Example
Flag orders over $100 as “High value”:
=IF(B2>100, "High value", "Standard")
If B2 is greater than 100, the cell shows High value; otherwise Standard.
2. Comparison Operators
Use any of these in the test:
=equal to —A2="Paid"<>not equal to —A2<>"Paid">/<greater / less than>=/<=greater or equal / less or equal
Comparing text? Wrap it in quotes: IF(A2="Done", …).
3. Return a Calculation
The results can be formulas, not just labels. Apply a 10% discount only to orders over $500:
=IF(B2>500, B2*0.9, B2)
4. Nested IF (Multiple Outcomes)
Chain IFs to grade into bands. Excel reads them top to bottom and stops at the first true test:
=IF(B2>=90, "A", IF(B2>=80, "B", IF(B2>=70, "C", "F")))
5. The IFS Function (Cleaner Than Nesting)
In Excel 2019/365, IFS replaces long nested IFs with a flat list of test/result pairs:
=IFS(B2>=90, "A", B2>=80, "B", B2>=70, "C", TRUE, "F")
The final TRUE, "F" acts as the catch-all “everything else”.
6. Combine IF With AND / OR
- AND — all conditions must be true:
=IF(AND(B2>100, C2="West"), "Yes", "No")
- OR — any condition can be true:
=IF(OR(C2="West", C2="East"), "Coastal", "Inland")
7. Troubleshooting
The formula shows TRUE or FALSE instead of my text
You only gave one argument. IF needs all three parts: test, true result, false result.
#VALUE! or unexpected text result
Text values in the test or results must be in quotes ("Paid"). Numbers must not be in quotes, or they’ll be treated as text.
Too many nested IFs
Excel allows up to 64 nested IFs, but they get unreadable fast. Switch to IFS, or use a lookup table with VLOOKUP or INDEX/MATCH.
Catch errors with IFERROR
To replace an error result with something friendly, wrap the formula: =IFERROR(your_formula, "Check input").
Related Excel guides: How to use SUMIF · How to use VLOOKUP · How to use INDEX MATCH · How to use conditional formatting · How to concatenate
Ready to automate your busywork?
Carly schedules, researches, and briefs you—so you can focus on what matters.
Get Carly Today →Or explore our free tools


