Use Different table in Vlookup based on number input

coyent

New Member
Joined
Apr 18, 2003
Messages
22
I would like to use a different table to do a Vlookup based on a number I enter in a field. The number entered would be an interger between 1 and 8. The table to be used would be Data1, Data2 and so forth to Data8 corresponding with the number entered in the input field. The Vlookup to be changed would be

=IF(ISNUMBER(A7),VLOOKUP(A7,Data1,2,FALSE)," ")

If I enter "1" in the input field "Data1" would be unchanged
If I enter "2" in the input field "Data1" would change to Data2"

Any ideas on how to do this?

Don
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
The input field is NOT the one in the IF statement...it is on another worksheet within the workbook
 
Upvote 0
You can use a combination of INDIRECT and INDEX. In the example, the yellow area is the data table named Data3. The listings in C2:C4 can be located on another sheet if need be. The formula checks the value in A2 and returns the corresponding label from C2:C4

HTH
Book1
ABCDEF
1TableWantedFieldNAME
23Data15BOB
3Data26JOE
4Data37BILL
58SALLY
6LookupValue
75BOB
Sheet1
 
Upvote 0
coyent said:
I would like to use a different table to do a Vlookup based on a number I enter in a field. The number entered would be an interger between 1 and 8. The table to be used would be Data1, Data2 and so forth to Data8 corresponding with the number entered in the input field. The Vlookup to be changed would be

=IF(ISNUMBER(A7),VLOOKUP(A7,Data1,2,FALSE)," ")

If I enter "1" in the input field "Data1" would be unchanged
If I enter "2" in the input field "Data1" would change to Data2"

Any ideas on how to do this?

Don
Use the INDIRECT function -- if the 1/2 bit were in sheet2, cell c2 then

=IF(ISNUMBER(A7),VLOOKUP(A7,INDIRECT("data"&sheet2!C2),2,FALSE),"')
 
Upvote 0
You can avoid the use of a volatile function such as INDIRECT by using...

=IF(ISNUMBER(A7),VLOOKUP(A7,CHOOSE(C2,Data1,Data2),2,FALSE)," ")
 
Upvote 0

Forum statistics

Threads
1,221,700
Messages
6,161,378
Members
451,700
Latest member
Eccymarge

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top