VLookup from different tables using Aproximate match

Avskedsfest

New Member
Joined
Feb 3, 2023
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I have a challenge

I would like to use Vlookup and aproximate match. But use different tables based in value in one cell. let me explain

If there is an "a" in first column I would like to run a Vlookup, searching for 10 in a table ranging from row z1:z10 (aproximate match). I there is a "b" in first column I would like to run a vlookup, searching for 120 in a table ranging from z11:z20 (aproximate match). etc

a 10
b 120
c 30

Any idea how I could make this happen?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
To return the approximate match from the relevant range, try...

Excel Formula:
=VLOOKUP(B2,CHOOSE(MATCH(A2,{"a","b","c"},0),$Z$1:$Z$10,$Z$11:$Z$20,$Z$21:$Z$30),1,TRUE)

...where A2 contains the letter, and B2 contains the lookup value.

Hope this helps!
 
Upvote 0
Perfect, thanks

Two follow up questions.

It seems that I cannot refer the "a" "b" and "c" to cells? Instead of "a" I would like to write a cell such as G5. This would make life simpler as in reality I have long text string instead and not a

Question 2, I would like to refer to tables in another worksheet. But when I try this it does not work. Is this a limitation?

Many thanks for your help
 
Upvote 0
hmmm, perhaps I ws too fast. It looks as if it works to move the table to a new sheet. I pressed F2 to review the formula and the colors of the reference were gone. I thought it was because it did not work, but it must have been due to the reference was in a different sheet....
 
Upvote 0
Try the following formula...

=VLOOKUP(B2,CHOOSE(MATCH(A2,$G$2:$G$4,0),'Sheet 2'!$Z$1:$Z$10,'Sheet 2'!$Z$11:$Z$20,'Sheet 2'!$Z$21:$Z$30),1,TRUE)

...where A2 contains the letter, B2 contains the lookup value, and G2:G4 contains "a", "b", and "c". Change the sheet name accordingly.

Hope this helps!
 
Upvote 0
Solution

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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