IF Function
Makes a decision: one result if a test is TRUE, another if it's FALSE.
Category
Logical
Available in
All versions, Microsoft 365
Returns
Whatever you tell it to return for TRUE or FALSE
Overview
IF is Excel's decision-maker. You give it a question that can only be answered TRUE or FALSE — like B2>=500 — and tell it what to return in each case.
It's the foundation for bonuses, pass/fail flags, tiered pricing and hiding unwanted results. Once IF clicks, AND, OR, IFS and IFERROR follow naturally.
Syntax
Arguments
| Argument | Required? | What it does |
|---|---|---|
| logical_test | Yes | Any comparison or value that works out to TRUE or FALSE, such as B2>=500 or C2="Closed". |
| value_if_true | Yes | What to return when the test is TRUE — text, a number, a cell or another formula. |
| value_if_false | Optional | What to return when the test is FALSE. Leave it out and IF returns FALSE. |
Examples
Example 1 — Did the rep hit target?
Northstar pays a bonus when monthly sales reach 500. Flag each rep with Yes or No.
| A | B | C | |
|---|---|---|---|
| 1 | Rep | Sales | Bonus? |
| 2 | Ana | 620 | Yes |
| 3 | Ben | 480 | No |
| 4 | Cara | 500 | Yes |
| 5 | Dev | 350 | No |
Cara's 500 counts because >= means “greater than or equal to”. Use > if exactly 500 shouldn't qualify.
Example 2 — Calculating, not just labelling
Pay 10% commission on sales of 500 or more, otherwise nothing.
| A | B | C | |
|---|---|---|---|
| 1 | Rep | Sales | Commission |
| 2 | Ana | 620 | 62 |
| 3 | Ben | 480 | 0 |
| 4 | Cara | 500 | 50 |
| 5 | Dev | 350 | 0 |
Example 3 — Nested IF for three outcomes
Grade a score as A (90+), B (80+) or C (anything lower).
- Excel checks B2>=90 first. If TRUE, the answer is A and it stops.
- If not, the second IF checks B2>=80 and returns B.
- Anything left falls through to C.
Example 4 — Leaving a cell blank
Only calculate tax once a price has been entered.
Two double quotes "" mean “empty text”, so the cell looks blank until B2 is filled in.
Common mistakes
- Text without quotes. Text results must be in double quotes: "Yes", not Yes. Without them Excel looks for a named range and returns #NAME?.
- Numbers in quotes. Writing "500" turns the number into text, so B2>="500" compares the wrong way. Leave numbers unquoted.
- Tests in the wrong order. In nested IFs the first TRUE test wins. Check the highest threshold first, or every score lands in the first band.
- An unexpected FALSE. You left out value_if_false and the test failed. Add a third argument, even if it's just "".
Notes
- A comparison on its own already returns TRUE/FALSE: =B2>=500 works without IF if TRUE/FALSE is all you need.
- Related functions: IFS, AND, OR, NOT, SWITCH, IFERROR.

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.