View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
PCLIVE
 
Posts: n/a
Default Lookup help, please

Using columns H and I for a lookup table:
Ex. H1 through H5 will contain the lookup values.
105
106
107
108
109

I1 through I5 will contain the results.
20
15
10
5
0

In G1, use the following formula:
=LOOKUP(A1,H1:I5)

If you need to prevent errors in case A1 is not found in the lookup table,
you can use something like the following:
=IF(COUNTIF(H1:H5,A1)=0,"Invalid Entry",LOOKUP(A1,H1:I5))


HTH,
Paul



"lmatt" wrote in message
...
I am trying to write a function such that the data returned to a given cell
will vary depending upon the data entered into another cell. For example:
If A1= 105, then G1=20; if A1=106, then G1=15

I have more variables for A1 than 7, so I don't think that nested
if...then
statements would work. Can I do this using VLOOKUP?

Thanks in advance.

L