Syntax
=IF(logical_test, value_if_true, [value_if_false])
| Argument | What it means |
|---|---|
logical_test | The question, such as B2>100. |
value_if_true | What to show when the answer is yes. |
value_if_false | What to show when the answer is no. If left out, FALSE is shown. |
Examples with results
Every result below is calculated by the practice engine on the sample data shown, not typed in by hand.
Monthly budget (fictional)
| Row | A | B | C |
|---|---|---|---|
| 1 | Category | Planned | Actual |
| 2 | Rent | 1200 | 1200 |
| 3 | Groceries | 400 | 462 |
| 4 | Transport | 150 | 128 |
| 5 | Utilities | 180 | 171 |
| 6 | Fun | 120 | 160 |
| 7 | Savings | 300 | 300 |
=IF(C3>B3,"Over budget","OK")Is Groceries over its plan?
Stock levels (fictional)
| Row | A | B | C | D | E |
|---|---|---|---|---|---|
| 1 | SKU | Item | On hand | Reorder level | Unit cost |
| 2 | A-100 | Hinge 40 mm | 120 | 50 | 0.8 |
| 3 | A-110 | Bracket set | 18 | 30 | 4.2 |
| 4 | A-120 | Oak board | 6 | 10 | 22 |
| 5 | A-130 | Zinc pin | 300 | 100 | 0.15 |
| 6 | A-140 | Door handle | 9 | 12 | 7.5 |
=IF(C3<=D3,"Reorder","OK")Does the bracket set need reordering?
Class scores (fictional)
| Row | A | B | C | D |
|---|---|---|---|---|
| 1 | Student | Maths | Science | English |
| 2 | Layla | 78 | 85 | 91 |
| 3 | Omar | 62 | 70 | 58 |
| 4 | Priya | 95 | 88 | 92 |
| 5 | Quinn | 45 | 52 | 61 |
| 6 | Rosa | 88 | 79 | 84 |
=IF(B3>=60,"Pass","Fail")Pass mark of 60
Try it yourself
Change the formula or switch to other sample data.
Press Calculate to see the result.
The practice box runs in your browser with BDK’s own calculator, which covers about 60 common functions. Cell references work as in Excel (B2, B2:B9). Your formulas are not saved or sent anywhere. For anything unusual, check the result in Excel itself.
How people use IF at work
- Education
Pass or fail for one student.
Data: Class scores (fictional)=IF(AVERAGE(B2:D2)>=70,"Merit","Standard") - Operations
Flag items that need ordering.
Data: Stock levels (fictional)=IF(C2<=D2,"Reorder","OK")
Common mistakes and tips
- Text in a result needs quotes: "Pass", not Pass.
- Nesting many IFs gets hard to read. Use IFS (Excel 2019 and later) or a lookup table instead.
Works in
All versions of Excel, and Google Sheets.
Lessons that use it
- Mark pass or fail and give a gradeBeginner lesson, about 6 min
- Find due dates and overdue invoicesIntermediate lesson, about 7 min
- Compare your budget with what you spentBeginner lesson, about 5 min
- Flag stock to reorder and value your inventoryBeginner lesson, about 6 min
- Check which items from one list are in anotherIntermediate lesson, about 7 min
Need Something Different? Let’s Talk.
Looking for different features or something built around your workflow? Share your idea with us.