View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Hank Scorpio
 
Posts: n/a
Default Only 8 if A5=this, then B4=that. How can I put in more?

On Fri, 6 Jan 2006 17:37:03 -0600, mcr1
wrote:

Never done that. I have no idea how to make a table. Any suggestions?
I cant even figure it out with the help function. Thanks again


The Help makes it about as clear as it can be, but let's try an
example that's customised to your own needs and see whether that makes
it easier.

Start with a blank workbook. Now, on sheet 1, go to cell A1 and enter
the text "Cell Value". (Without the quotes)

In cell B1, enter "Lookup value". These will be your table headings.
(Which aren't really needed, but they make it easier to follow what's
going on.)

Now format the cells below those as Text. (Select the cells, then go
Format - Cells and set the Number Format as Text.) You need to do
this because some of your lookup values have leading zeroes.

Now enter the following values into the cells specified below:
Cell Value
A2 1K
B2 51126
A3 2AC
B3 36320
A4 0AP
B4 49003
A5 3AC
B5 36316

So you can see that you have the IF condition in column A, and the
value that you want in column B right alongside it. This is your
lookup table.

You can run this lookup table down as far as you want it to go.

Now, go to sheet 2 and enter the text "2AC" (again without the quotes)
into cell F5. (We've chosen F5 only because it corresponds with your
original formula.)

Now in any OTHER cell, enter the following formula:
=VLOOKUP(F5,Sheet1!$A$1:$B$5,2,FALSE)

What you should see is the value 36320; that is, the return value for
the code 2AC.

The VLookup has 4 arguments, and what they mean is this:
WHAT value do you want to look up? Whatever's in cell F5.
WHERE do you want to look it up from? The table Sheet1!$A$1:$B$5.
WHICH column contains the value that we want to look up? Column 2.
DO we want an approximate match? No, which is why the last argument is
False.

In reality I wouldn't enter the lookup table into the VLookup formula
using absolute cell references like this, I'd use a range name. And a
dynamic range name at that. However taking it one step at a time, see
whether the above example makes it a bit clearer for you. If it does,
and you'd like to improve it by using range names, post again and
we'll take it from there.

---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *