Microsoft Office Tutorials and References

In Depth Information

**Testing on One Condition**

in stock and the reorder level is two. In the next row, the number of Flying Xs

is equal to the reorder level; therefore, cell F9 displays Order.

Using IF is easy:

1. Enter two values in a worksheet.

These values should have some meaning to you, such as the inventory

levels example in Figure 14-1.

2. Click the cell where you want the result to appear.

3. Enter
=IF(
to start the function.

4. Decide what test you want to perform.

You can see whether the two values equal each other; whether one is

larger than the other; whether subtracting one from the other is greater

than, equal to, or less than 0; and so on. For example, to determine

whether the first value equals the second value, click the first cell (or

enter its address), enter an equal sign (=), and then click the second

cell (or enter its address).

5. Enter a comma (
,).

6. Enter the result that should appear if the test is
true
.

For example, enter
“Thevaluesareequal”
. Remember, text must be

enclosed in quotes.

7. Enter a comma (
,).

8. Enter the result that should appear if the test is
false
.

For example, enter
“Thevaluesarenotequal”
.

9. Enter a
), and press Enter.

The IF function can do a whole lot more. Nested IF functions give you a lot

more flexibility in performing tests on your worksheet data. A bit of

perseverance is necessary to get through this.
Nested
means that you can place an IF

function inside another IF function. That is, the inner IF is placed where the

true or false argument in the outer IF goes (or even use internal IFs for both

of the arguments). Why would you do this?

The other night we were deciding where to go for dinner. We were

considering Italian, and decided that if we went to an Italian place, and it served

manicotti, then we would have manicotti. Otherwise, we decided to just eat pizza.