Microsoft Office Tutorials and References

In Depth Information

**Making Decisions — The IF Function**

The IF function instructs Excel that, if the projected July revenue in cell B13 is greater

than or equal to the sales revenue for bonus value in cell B7, then Excel should display the

value 200000 in cell B2, in cell B18. If the projected July revenue in cell B13 is less than the

sales revenue for bonus value in cell B7, then Excel displays a 0 (zero) in cell B18.

The general form of the IF function is:

=IF(logical_test, value_if_true, value_if_false)

The argument, logical_test, is made up of two expressions and a comparison

operator. Each expression can be a cell reference, a number, text, a function, or a formula.

Valid comparison operators, their meaning, and examples of their use in IF functions are

shown in Table 3 – 8. The argument, value_if_true, is the value you want Excel to display

in the cell when the logical test is true. The argument, value_if_false, is the value you want

Excel to display in the cell when the logical test is false.

Table 3 – 8 Comparison Operators

Comparison

Operator

Meaning

Example

=

Equal to

=IF(B12 = 200, F3 * H4, E10 + F3)

<

Less than

=IF(G56 * Q56 < D12, $M$10, B9 ^ 5)

>

Greater than

=IF(MIN(A12:A52) > 75, 0, 1)

>=

Greater than or equal to

=IF($T$9 >= B7, P3 - H12, 1000)

<=

Less than or equal to

=IF(C9 * G2 <= 99, $T35, 350 * C9)

<>

Not equal to

=IF(G15 <> 1, “No”,“Yes”)

To Enter an IF Function

The following steps assign the IF function =IF(B13>=$B$7,$B$2,0) to cell B18. This IF function determines

whether or not the worksheet assigns a bonus for July.

1

•

Click cell B18 to select

the cell for the next

formula.

Insert Function

dialog box

•

Click the Insert

Function box in the

formula bar to display

the Insert Function

dialog box.

‘Or select a

category’

box arrow

•

Click the ‘Or select a

category’ box arrow

(Insert Function dialog

box) and then select

Logical in the list to

populate the ‘Select

a function’ list with

logic functions.

IF function

selected

description

of selected

function

cell B18 selected

OK button

•

Click IF in the ‘Select a

function list’ to select

the required function

(Figure 3 – 28).

Figure 3 –28