Excel 2000 : A Sample Application    More on Formulas  

Let's take this one step at a time. First we want to say IF the product is a widget, then LOOKUP use the Units (units sold, column C) to look up the Unit Price in the table H16:I19.

We can use the IF function for this. The IF function looks like this:

="IF"(Condition,X,Y)

X gets executed or returned if "Condition" is true, and "Y" gets executed or returned if "Condition" is false.

So, we can take care of the "widget" lookups like this (starting with the second row).

="IF"(B2="widget",LOOKUP(C2,H16:H19,I16:I19),"")

Oops... we have to use absolute addressing on the lookup table, like this:

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

If this is starting to look a bit intimidating, don't worry. More elegant ways of doing the same thing will be covered in a later tutorial. (However, these more elegant ways take more pages to explain, and this tutorial is just an introduction.) For now, just remember that you can use formulas in Excel to do just about anything. This tutorial is giving you a quick look at some of the more powerful features of Excel, and it isn't necessary to master anything yet.

 
screenbooks home site

2 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