Logiceasy
IF()
Returns one value if a condition is TRUE, another if FALSE.
Syntax
fx
=IF(logical_expression, value_if_true, value_if_false)
Try it
F2
→
Big quarter
Sample data · sales.csv
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Company | Region | Quarter | Revenue |
| 2 | Acme Co | West | Q1 | 18,400 |
| 3 | Acme Co | West | Q2 | 22,100 |
| 4 | Acme Co | West | Q3 | 31,700 |
| 5 | Acme Co | West | Q4 | 48,200 |
| 6 | Globex | East | Q1 | 14,200 |
| 7 | Globex | East | Q2 | 19,800 |
| 8 | Globex | East | Q3 | 23,400 |
Common pitfalls
- Nested
IFs become unreadable past 2-3 levels. Reach forIFSorSWITCHinstead. - Both branches are evaluated lazily, so you can safely return
1/0or other errors in unused branches without breaking the formula. - For multiple conditions, use
AND/ORinside the test rather than nestingIFs.
Related formulas
IFS()
Evaluates multiple conditions and returns a value for the first TRUE.
IFERROR()
Returns the first argument if it isn't an error; otherwise returns the second.
AND()
Returns TRUE if all of the provided arguments are logically true.
OR()
Returns TRUE if any of the provided arguments are logically true.
Used by
IFS()
Evaluates multiple conditions and returns a value for the first TRUE.
IFERROR()
Returns the first argument if it isn't an error; otherwise returns the second.
IFNA()
Returns the first argument unless it is the #N/A error, in which case returns the second.
AND()
Returns TRUE if all of the provided arguments are logically true.
OR()
Returns TRUE if any of the provided arguments are logically true.
NOT()
Returns the opposite of a logical value: NOT(TRUE) = FALSE.