IF Function

Excel Functions › Logical

All Excel versions

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.


Quick answer: to label every score of 70 or more “Pass” and everything else “Fail”:
=IF(B2>=70, "Pass", "Fail")
The first argument is the test, the second is what to show when it’s TRUE, the third when it’s FALSE. Text outcomes always need quotes.

Syntax

=IF(logical_test, [value_if_true], [value_if_false])
ArgumentDescription
logical_testRequiredAny expression that evaluates to TRUE or FALSE: B2>=70, A2="West", AND(B2>0, C2<100).
value_if_trueOptionalWhat to return when the test is TRUE. Can be text, a number, a cell reference, or another formula.
value_if_falseOptionalWhat 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:

ABC
1NameScoreStatus
2Avery84Pass
3Blake62Fail
4Casey70Pass
5Drew91Pass
=IF(B2>=70, "Pass", "Fail") // copied down from C2

The comparison operators are =, <> (not equal), >, >=, <, and <=. Outcomes don’t have to be text — they can be calculations:

=IF(B2>=70, B2*0.1, 0) // 10% bonus on a passing score, otherwise zero

To show nothing on the FALSE branch, return an empty string:

=IF(B2>=90, "Honor roll", "")

Try it: interactive IF demo

Live 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:

=IF(AND(B2>=70, C2>=70), "Pass", "Fail") // both exams must pass
=IF(OR(A2="West", A2="South"), "Field team", "HQ team") // either region qualifies

You can also nest IF inside IF for more than two outcomes:

=IF(B2>=90, "A", IF(B2>=80, "B", IF(B2>=70, "C", "F")))

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

📊
Download the free IF practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

Can I use IF with multiple conditions?
Yes — wrap the conditions in AND or OR inside the test: =IF(AND(B2>=70, C2>=70), "Pass", "Fail") requires both; =IF(OR(B2>=70, C2>=70), "Pass", "Fail") accepts either. See the AND and OR pages.
How many IF functions can I nest?
Excel allows up to 64 nested IFs, but anything past about three becomes hard to read and audit. For tiered logic use IFS (Excel 2019+); for exact-value matching use SWITCH; for long lists use a lookup table with XLOOKUP.
How do I make IF return a blank cell?
Return an empty string: =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?
You left out 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?
No. =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?
IF handles one test with two outcomes and must be nested for more. IFS (Excel 2019+) takes a flat list of test/value pairs and returns the value for the first test that's TRUE - no nesting, no parenthesis pile-up.

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

Related functions: IFS · SWITCH · AND · OR · IFERROR · XLOOKUP