Excel 2000 : A Sample Application    More on Formulas  

How are we going to get entries for flangers and tweezers? Let's take a look at the IF statement again.

You will recall that the format for the IF statement is:

="IF"(Condition, X, Y)

"Y" is what gets carried out if the Condition is false. We haven't used that yet. What we can do is paste another IF statement into Y (this is called "nesting" a formula). This starts to look a bit messy, and if you didn't like the previous formula you may want to avert your eyes. But the basic logic is simple. (And remember, more manageable ways to do the same thing will be presented in a later tutorial.)

An IF statement that has three "levels" and competely takes care of our present needs looks like this:

="IF"(B2="widget",LOOKUP(C2,$H$16:$H$19,$I$16:$I$19),

    IF(B2="flanger",LOOKUP(C2,$H$8:$H$11,$I$8:$I$11),

        IF(B2="tweezer",LOOKUP(C2,$H$12:$H$15,$I$12:$I$15))

    )

)

 
screenbooks home site

5 of 8
  Text Author: Joe Orr   Copyright 2000 All Rights Reserved  
  Created with ScreenBook Maker   Last update: 12/20/2002   Additional Trademark and Copyright Information