The Excel IF function is the workhorse of every spreadsheet decision: it tests a condition and returns one value when the test is TRUE and another when it’s FALSE. Pass or fail, bonus or no bonus, ship or hold — if your logic has two outcomes, IF handles it in one line. When the outcomes multiply, its modern siblings IFS and SWITCH take over.
Syntax
| Argument | Description | |
|---|---|---|
logical_test | Required | Any expression that evaluates to TRUE or FALSE: B2>=70, A2="West", AND(B2>0, C2<100). |
value_if_true | Optional | What to return when the test is TRUE. Can be text, a number, a cell reference, or another formula. |
value_if_false | Optional | What to return when the test is FALSE. Omit it and IF returns the word FALSE — usually not what you want. |
Available in: every version of Excel, desktop and web. IF is one of the oldest functions in the program and behaves identically everywhere.
One test, two outcomes
Scores sit in B2:B5. One formula in C2, copied down, grades the whole class:
| A | B | C | |
|---|---|---|---|
| 1 | Name | Score | Status |
| 2 | Avery | 84 | Pass |
| 3 | Blake | 62 | Fail |
| 4 | Casey | 70 | Pass |
| 5 | Drew | 91 | Pass |
The comparison operators are =, <> (not equal), >, >=, <, and <=. Outcomes don’t have to be text — they can be calculations:
To show nothing on the FALSE branch, return an empty string:
Try it: interactive IF demo
Build an IF formula live: set the score, the passing mark, and both outcomes, then watch which branch fires.
Combine IF with AND, OR — and know when to stop nesting
A single IF tests one condition. To require several at once, hand the test to AND; to accept any of several, use OR:
You can also nest IF inside IF for more than two outcomes:
Three levels deep is the pain threshold. Every extra nest adds a parenthesis to balance and a branch to misread. If you have Excel 2019 or later, rewrite stacked IFs as a single IFS — same logic, flat list, no closing-bracket pile-up. When you’re matching one value against a list of exact alternatives, SWITCH is tidier still.
Errors & common pitfalls
#NAME? — unquoted text. =IF(B2>=70, Pass, Fail) fails because Excel reads Pass as a range name. Text outcomes and text comparisons always need quotes: "Pass".
The word FALSE appears instead of your value. You omitted value_if_false. =IF(B2>=70,"Pass") returns FALSE for failing scores — add the third argument, even if it’s just "".
Pitfall: numbers stored as text. "70" typed as text never equals the number 70, so tests like B2>=70 quietly misfire. Look for the green corner triangle, or convert with VALUE().
Pitfall: boundary off-by-one. > excludes the boundary value, >= includes it. A passing mark of 70 graded with B2>70 fails everyone who scored exactly 70.
Pitfall: nesting past readability. Excel allows 64 nested IFs; your colleagues allow about three. Switch to IFS or a lookup table with XLOOKUP before the formula becomes write-only.
Practice workbook
Frequently asked questions
Can I use IF with multiple conditions?
How many IF functions can I nest?
How do I make IF return a blank cell?
=IF(B2>=90, "Honor roll", ""). The cell looks blank but technically contains text — ISBLANK on it returns FALSE, and it can affect COUNTA.Why does my IF formula show FALSE?
value_if_false. When the test fails and there is no third argument, IF returns the logical value FALSE. Add the third argument — even "" for an empty result.Is IF case-sensitive when comparing text?
=IF(A2="west", …) matches “West”, “WEST”, and “west” alike. For a case-sensitive test, use EXACT: =IF(EXACT(A2,"West"), …).What's the difference between IF and IFS?
Master functions like this in one day
This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class