creating a range reference from cell values

G

Guest

I am try to do a vlookup where the range is built from cell values ex.

=VLOOKUP($K$16,TRIM(B17&"!"&"A1:L32"),3,FALSE)

b17 contains the sheet name

but gives me a #value! error

but works if the range is hard coded

But I really want to build the range dynamiclly

Can anyone help ???
thanks
 
G

Guest

You'll need to use the INDIRECT function. You could basically just replace
TRIM with INDIRECT in your formula and it should work.

=VLOOKUP($K$16,INDIRECT(B17&"!A1:L32"),3,FALSE)

Not sure why you're using the TRIM function in the first place, unless B17
may contain extra spaces? If so, just place B17 in the TRIM function.
....INDIRECT(TRIM(B17)&"!...

HTH,
Elkar
 
D

Dave Peterson

=VLOOKUP($K$16,indirect("'" & TRIM(B17) &"'!"&"A1:L32"),3,FALSE)

Are you sure you need the =trim() portion?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top