IF Function in Numbers: Conditions with Examples
The examples use this table.
| A | B | C | |
|---|---|---|---|
| 1 | Product | Price | Qty |
| 2 | Apple | 4 | 10 |
| 3 | Pear | 6 | 5 |
| 4 | Kiwi | 12 | 2 |
| 5 | Grape | 8 | 3 |
The basics of IF
IF has three parts: a condition, what to show if it is true and what to show if it is not. Here the price in B4 is higher than 10, so the result is the first text.
=IF(B4>10,"Expensive","Cheap")Result: Expensive
Comparisons and text
You compare with >, <, >=, <= and =. Put text results between quotation marks, otherwise Numbers looks for a function or cell with that name.
Several conditions with AND and OR
AND returns TRUE if all conditions are true. OR returns TRUE if at least one condition is true. Use them inside an IF or on their own.
=AND(B2>3,C2>5)Result: TRUE
=OR(B2>10,C2>20)Result: FALSE
An IF inside an IF
For more than two results, put an IF in the last argument of another IF. The formula checks the conditions one by one.
=IF(B3>10,"A",IF(B3>5,"B","C"))Result: B
Catching errors with IFERROR
If a formula returns an error, for example because a lookup value is missing, IFERROR shows your own text.
=IFERROR(VLOOKUP("Mango",A2:C5,2,0),"Not found")Result: Not found
Frequently asked questions
How do I use IF with several conditions?
Combine them with AND (all must be true) or OR (one is enough).
How do I put text in an IF?
Put the text between quotation marks, for example "Expensive".
What happens if the condition is not met?
IF returns the third argument.
Functions in this article
Practise it yourself
Type the formula yourself in a real exercise and see right away if your answer is correct. The first exercises are free.
Start practising