Professional Documents
Culture Documents
Combine Two Formulas in Excel With IF: Show Comments
Combine Two Formulas in Excel With IF: Show Comments
Excel functions are predefined formulas for frequently used calculations. The IF
function performs a logical test between two values, returning one value if the
comparison is true and another if it's false. The syntax of the IF function is IF(test,
value if true, value if false). For example, the formula =IF(C1>B1,C1-B1,0)
compares the value in cell C1 to the value in cell B1. If the value in C1 is greater
than B1, the result displayed in the cell is the difference between the values in C1
and B1. If the value in B1 is greater than C1, the displayed result is 0.
The IF function becomes even more powerful when nesting is used. The term
nesting refers to using a function as an argument to another function in a
formula. For example, the SUM and AVERAGE functions are nested within the IF
function in this formula: =IF(SUM(A2:A6)>100,SUM(A2:A6),AVERAGE(A2:A6)),
which tests whether the sum of a range of cell values is greater than 100 and
returns the sum of the values if true or the average of the values if false. Excel
allows function nesting up to 64 levels deep, which accommodates both simple
and complex calculations within a single formula.