• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

about Vlookup

ttklee

New Member
let's say I named different table ranges as TableA & TableB.
eg.
=Vlookup(A1,TableA,1)
=Vlookup(A1,TableB,1)

What formula should I put to get TableA/TableB as a variable into the Vlookup table array?

I tried another Vlookup to get TableA/TableB as value into above formula doesn't work.
=Vlookup(A1,result of another Vlookup to get TableA/TableB,1)
 
Hi
using Vlookup in this way is useless, as you are searching for a value in the first column (=Vlookup(A1,TableA,1)) , which will return that same value
If you are trying to combine two tables to perform a lookup, depending on your XL version you could use the VSTACK function
Perhaps post a sample sheet ( no pics please)
 
ttklee

For me it is not very clear what you are asking.
Maybe you can read our forum rules and best practices (link in my signature) to ensure you create better threads, meaning in such way we can help you.

Did your read the inner help on VLOOKUP function? I'm guessing your formula is not working since it is not following the "rules" of the function.

EDIT: or like @pecoflyer picks up, you might not be needing VLOOKUP at all.
 
You can do something like this:
=VLOOKUP(A1,IF(J3=1,TableA,TableB),1)
where if cell J3 is 1 it will lookup on Table1, otherwise it'll lookup on Table2

If you have lots of tables, you could set up another table to lookup which table you want to lookup (!!):
=VLOOKUP(A1,INDIRECT(VLOOKUP(J3,TableNames,2,0)),1)
where TableNames is a table whose second column contains the names (as strings) of the tables you want to use.

re:
using Vlookup in this way is useless, as you are searching for a value in the first column (=Vlookup(A1,TableA,1)) , which will return that same value
Well, the user could be trying to confirm whether a value exists in a table? However, in this case the 4th argument of the OP's VLOOKUP is missing so an approximate match is returned! Who knows?
 
Back
Top