Excel 2019 Bible

(singke) #1

Part II: Working with Formulas and Functions


FIGURE 13.1
Monthly gas prices by state

The IF function is the most basic conditional analysis function in Excel. It has three argu-
ments: the condition, what to do if the condition is true, and what to do if the condition
is false.

The condition argument in this example is C3>AVERAGE(C$3:C$11). Condition arguments
must be structured to return TRUE or FALSE, and this usually means that there is a compar-
ison operation (like an equal sign or greater-than sign) or another worksheet function that
returns TRUE or FALSE (like ISERR or ISBLANK). The example condition has a greater-than
sign and compares the value in C3 to the average of all the values in C3:C11.

If our condition argument returns TRUE, the second argument of the IF function is
returned to the cell. The second argument is High, and since the value in C3 is indeed
larger than the average, cell C14 shows the word High.

Cell C15 compares the value in C4 to the average. Because it is lower, the condition argu-
ment returns FALSE, and the third argument is returned. Cell C15 shows Low, the third
argument of the IF function.

Checking for multiple conditions
Simple conditions like the one shown in Figure 13.1 can be strung together. This is known
as nesting functions. The value_if_true and value_if_false arguments can contain
Free download pdf