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.

  1. In B2, write an IF formula that shows Done when A2 is Paid and Chase otherwise.
Step 1 of 2
Formulas here use English function names, such as SUM, and a period as the decimal separator, in every language.
Loading the sheet…

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 "=>".

Related functions

These links are related functions.