Logical
Making a cell decide
Definition
An IF condition compares two things and shows one result when the comparison holds and another when it does not.
Syntax
=IF(B2>20,"Heavy","Standard")
Arguments
| Argument | Meaning |
|---|---|
B2>20 |
The comparison. Operators include =, <>, <, >, <=, and >=. |
"Heavy" |
The result when the comparison is true. |
"Standard" |
The result when the comparison is false. |
Worked example
A courier labels parcels as heavy when they weigh more than 20 kg. Weights are in B2:B4.
| A: Parcel | B: Weight (kg) |
|---|---|
| Box 1 | 4 |
| Box 2 | 34 |
| Box 3 | 15 |
Formula: =IF(B2>20,"Heavy","Standard")
Result: Standard. 4 is not above 20, so the false result is shown. Filled down, the three rows read Standard, Heavy, and Standard.
Practice
Cell A2 holds the word Paid. In B2, write a formula that shows Done when A2 equals Paid and Chase for anything else.
- In B2, write an IF formula that shows Done when A2 is Paid and Chase otherwise.
- B2 should show the result for Paid.
Related functions
IF is the function behind this lesson, and its result can be fed by other formulas in the same way.
Common mistake
Writing the operator the wrong way round, as in B2=>20; Excel only accepts >= and rejects "=>".