IF practice exercises
IF checks a condition and returns one value when it is true and another when it is false. It is the building block for flags, labels, bonuses and almost every "it depends" in a spreadsheet.
Syntax
IF(condition, value_if_true, value_if_false)
condition- A test that is TRUE or FALSE, like
F2>=100orB2="East". value_if_true- What to return when the test is TRUE.
value_if_false- What to return when it is FALSE.
The practice data
An orders table: who sold what, where, and for how much. Every exercise below uses this sheet, and your answer goes in H2.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Rep | Region | Product | Units | Price | Sales |
| 2 | Ana | East | Widget | 12 | 5 | 60 |
| 3 | Ben | West | Gadget | 5 | 20 | 100 |
| 4 | Cara | East | Gadget | 8 | 20 | 160 |
| 5 | Dev | North | Widget | 20 | 5 | 100 |
| 6 | Ana | West | Gizmo | 3 | 50 | 150 |
| 7 | Ben | East | Widget | 7 | 5 | 35 |
| 8 | Cara | North | Gizmo | 2 | 50 | 100 |
| 9 | Dev | East | Gadget | 6 | 20 | 120 |
Worked example
=IF(F3>=100,"Big","Small")
Row 3 has Sales of 100, so the result is "Big". Result:
| Big |
Your turn: 3 exercises
Type a formula and press Enter. It is checked by a real formula engine, so any correct approach counts.
1 Return Big if the Sales in F2 are 100 or more, otherwise Small.
2 Return Bonus if the Units in D5 are more than 10, otherwise -.
3 If the Region in B2 is East, return the Sales in F2 with 10% off (F2*0.9). Otherwise return F2 unchanged.
Practice IF in the full lesson, free
Lesson 4 has more exercises in a real spreadsheet grid, with hints and progress tracking. No card needed.
Open lesson 4Common IF mistakes
- Forgetting quotes around text:
"Big", notBig. - Writing
=>instead of>=. - Nesting many IFs when IFS would be clearer.
FAQ
How do I test two conditions in IF?
Use AND or OR inside the condition: =IF(AND(B2="East",F2>100),"Yes","No").
How do I leave the cell blank when false?
Use empty quotes: =IF(F2>100,"Big","").