IF is Excel's decision-maker. Once you understand it you will use it in almost every spreadsheet. Here is the complete guide with 6 real examples.
IF makes Excel make a decision. You give it a condition to test — if the condition is TRUE, it returns one result; if FALSE, it returns another. This lets your spreadsheet respond differently to different data automatically.
IF is the gateway to logic in Excel. Once you understand it, you can flag overdue invoices, calculate variable bonuses, label data automatically, and build dynamic dashboards that respond to changing numbers.
=IF(logical_test, value_if_true, value_if_false)| Argument | Description |
|---|---|
| logical_test required | A condition that evaluates to TRUE or FALSE. Examples: A2>100, B2="Yes", C2<>"" |
| value_if_true required | What to return when the condition is TRUE. Can be text (in quotes), a number, a formula, or a cell reference. |
| value_if_false required | What to return when the condition is FALSE. Same options as value_if_true. |
> greater than · < less than · >= greater or equal · <= less or equal · = equal · <> not equal
=IF(B2>=50, "Pass", "Fail")If the score in B2 is 50 or above, show Pass. Otherwise show Fail.
Pay a 10% bonus only if sales exceed £5,000.
=IF(B2>5000, B2*0.1, 0)Note: when returning a number or formula, no quotes are needed.
=IF(C2<TODAY(), "Overdue", "Current")=IF(A2="", "Missing", "Complete")=IF(B2=0, 0, A2/B2)If the denominator is zero, return 0 instead of a #DIV/0! error.
=IF(B2>50000, B2*0.4, B2*0.2)40% tax above £50,000; 20% below. The formula picks the right rate automatically.
Put an IF inside another IF to handle multiple outcomes. This is called nesting.
=IF(B2>=70, "First", IF(B2>=60, "2:1", IF(B2>=50, "2:2", "Fail")))
Deeply nested IFs are hard to read and maintain. Use IFS() for multiple conditions — it's cleaner and less error-prone.
Cleaner version using IFS:
=IFS(B2>=70, "First", B2>=60, "2:1", B2>=50, "2:2", TRUE, "Fail")
Test multiple conditions at once by combining IF with AND or OR.
Both conditions must be true (AND):
=IF(AND(B2>=50, C2="Attended"), "Pass", "Fail")
At least one condition must be true (OR):
=IF(OR(B2>=90, C2="Distinction"), "Award", "Standard")
=IF(A2>10, Pass, Fail) will error. Text results need quotes: =IF(A2>10, "Pass", "Fail").
In Excel, a single = is used for equality comparison inside IF. =IF(A2=10, ...) is correct. Do not use == like in other programming languages.
If you leave out value_if_false, Excel returns FALSE when the condition is not met, which can look confusing. Always include a third argument, even if it's just 0 or "".
ExcelPro's Basics track has 6 IF exercises — from simple pass/fail to nested IFs and AND/OR logic. Free to start.
Try IF exercises free →