Using Variables in Vlookups.


Posted by Lael Buchanan on December 11, 1999 10:14 AM

Hello,

Got a good one for anyone that can help. I have a Vlookup that I need to do where the table that it is looking on varies depending on another variable. So my lookup loks something like this:

Vlookup($C$8,(Variable Table),2)

I've tried to use a nested Vlookup to find the right table, but that didn't seem to work as all I got was a #Value error. Can anyone give me any information on hwo to get a variable to work withing a vlookup?

Thanks in advance,

Lael Buchanan

Posted by Marcus Macrae on December 13, 1999 7:45 AM

Lael,

Use the INDIRECT function:
Vlookup($C$8,INDIRECT(Variable_Table),2)
will look in Table1 if Variable_Table is "Table1", etc.

- Marcus



Posted by Lael Buchanan on December 13, 1999 9:04 AM

That worked perfectly. Thank you for the help.

Lael