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

It's a thing of beauty...

It all seems so obvious once it's pointed out.

Thanks again, all.

L

"PCLIVE" wrote:

Now if you wanted to go the route of VLOOKUP, you would need to arrange a
table in your worksheet in the following manner. Notice that it is in
ascending order by the first column This is necessary for the lookup to
work properly.
Col. D Col. E
102 20
103 12
105 20
106 15
109 60
113 25
115 35
116 20
120 20
130 15
131 20
140 15
150 15
160 60
170 30
180 20



Now your VLOOKUP formula:
=VLOOKUP(A1,D1:E16,2)

Once again, to prevent and error when the value doesn't exist in the table
you can use:
=IF(COUNTIF(D1:D16,A1)=0,"Not Found",VLOOKUP(A1,D1:E16,2))

HTH,
Paul


"Sloth" wrote in message
...
give me all the values you need and I will show you how to adapt our
functions to work for you.

"lmatt" wrote:

Thanks, all. My fault for not asking the question properly: what I meant
to
say was: if I have a value in cell A1 that can change, how can I write a
function that will return a given value to the specified cell, e.g., if
cell
A1=105, then cell G1=10; if cell A1=106, then cell G1=20, etc. Further,
values along column A can repeat, and the result must always be the same
in
column G for that row. Maybe if...then isn't far off after all?

Again, thanks for any clarification you can give...

L

"Sloth" wrote:

you have a couple options. One is to use the VLOOKUP function as
PCLIVE
suggested. If you don't want to insert a table you can insert the
table as
part of the function like this
=VLOOKUP(A1,{105,20;106,15;107,10},2)
also if the options are linear (105, 106, 107, 108, 109, etc.) you can
use
the CHOOSE function like this
=CHOOSE(A1-104,20,15,10)


"lmatt" wrote:

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