Lookup and retrieve value based on table code (2)

Lux Aeterna

Board Regular
Joined
Aug 27, 2015
Messages
199
Office Version
  1. 2019
Platform
  1. Windows
This is a follow-up question regarding a previous thread that was successfully handled by @Peter_SSs

I need a formula for cell C21 that will look up the value in B21 on the correct sheet. The correct sheet is specified in P1, and the table for the VLOOKUP function is located in the range N3:O76.

1723535980585.png


The data should be retrieved from the "D*" sheet, within the range R7:R11. I can make modifications to that range, such as adjusting the data, splitting it into two columns, reversing the order, substituting "to," or anything else necessary. Please note that R7 represents "greater than or equal to" and R11 represents "less than or equal to".

1723536058618.png


The formula @Peter_SSs used, in case you need it, is
Excel Formula:
=INDEX(INDIRECT("'"&VLOOKUP(P$2;$N$3:$O$76;2;0)&"'!C$7:C$99");MATCH(B5;--LEFT(INDIRECT("'"&VLOOKUP($P$2;$N$3:$O$76;2;0)&"'!D7:D99");FIND("-";INDIRECT("'"&VLOOKUP($P$2;$N$3:$O$76;2;0)&"'!D7:D99")&"-")-1);1))

A previous version of my file is here. I have made some alterations, but the basic structure remains the same.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
You can use " to " separate the values in column R of the lookup sheet but, like the previous thread, those values need to be in ascending order in the column (and also ascending left to right in a 'range cell')
So column R of the lookup sheet would need to be something like this.

Lux Arterna WCST Normative data - backup.xlsm
R
6Learning to Learn
7-10000 to -42.41
8-42.40 to -27.81
9-27.80 to -22.21
10-22.20 to -11.35
11-11.34
D1


Then your formula in C22 (I assume C21 & B21 in your post above were typos) could be
Excel Formula:
=INDEX(INDIRECT("'"&VLOOKUP(O$2,$M$3:$N$76,2,0)&"'!N$7:N$11"),MATCH(B22,--LEFT(INDIRECT("'"&VLOOKUP($O$2,$M$3:$N$76,2,0)&"'!r7:r11"),FIND(" to ",INDIRECT("'"&VLOOKUP($O$2,$M$3:$N$76,2,0)&"'!r7:r11")&" to ")-1),1))
 
Upvote 0
Solution
You can use " to " separate the values in column R of the lookup sheet but, like the previous thread, those values need to be in ascending order in the column (and also ascending left to right in a 'range cell')
So column R of the lookup sheet would need to be something like this.

Lux Arterna WCST Normative data - backup.xlsm
R
6Learning to Learn
7-10000 to -42.41
8-42.40 to -27.81
9-27.80 to -22.21
10-22.20 to -11.35
11-11.34
D1


Then your formula in C22 (I assume C21 & B21 in your post above were typos) could be
Excel Formula:
=INDEX(INDIRECT("'"&VLOOKUP(O$2,$M$3:$N$76,2,0)&"'!N$7:N$11"),MATCH(B22,--LEFT(INDIRECT("'"&VLOOKUP($O$2,$M$3:$N$76,2,0)&"'!r7:r11"),FIND(" to ",INDIRECT("'"&VLOOKUP($O$2,$M$3:$N$76,2,0)&"'!r7:r11")&" to ")-1),1))
Excel Formula:
=INDEX(INDIRECT("'"&VLOOKUP($P$2;$N$3:$O$76;2;0)&"'!Y$7:Y$99");MATCH(B14;--LEFT(INDIRECT("'"&VLOOKUP($P$2;$N$3:$O$76;2;0)&"'!Z$7:Z$99");FIND("-";INDIRECT("'"&VLOOKUP($P$2;$N$3:$O$76;2;0)&"'!Z$7:Z$99")&"-")-1);1))

Changed the cell references as necessary, and works perfectly!

🙏
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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