INDEX & MATCH functions with VLOOKUP function as {array} argument (Excel 2013, Windows 8.1)

Colo_Mike

New Member
Joined
May 4, 2015
Messages
7
(Excel 2013 / Windows 8.0)

Hello, I’m having trouble using the INDEX and MATCH functions with a variable “array” argument. The variable is a list of worksheet names (all of which are in this same workbook). This list of worksheet names is on another tab within the same workbook. My hope is a solution using functions. I have not learned to use VBA so, if possible, please limit your suggestions to use of functions. Thanks.

For example, the worksheet names I need to use in the INDEX and MATCH functions are listed on a separate worksheet named “MAIN” like this:

Worksheet “MAIN”:

Column:BJ
Rows:"ID""Worksheet Name"
8100100_GCs
9200200_Permits
10300300_Demo
Etc...

<tbody>
</tbody>


Then, on another worksheet (called "Bid Details"), I’m trying to use VLOOKUP to insert the appropriate worksheet name within the INDEX and MATCH functions. Here is a sample of the data on worksheet "Bid Details":

Column:BC
Rows:"Code""Description"
2100
4100.010**INDEX function goes here**
5100.020**INDEX function goes here**
Etc...

<tbody>
</tbody>


On worksheet "Bid Details” I have a couple hundred rows, each using an INDEX/MATCH functions. In this example the worksheet name ("100_GCs") is hardcoded:
=INDEX('100_GCs'!$P$12:$Q$40,MATCH(RIGHT(B4,3),'100_GCs'!$Q$12:$Q$40),1)

This version of the function works, however I don’t want to have to hardcode the sheet name into each of my INDEX functions. Additionally, the range within this INDEX function (!$P$12:$Q$40) and the MATCH function ($Q$12:$Q$40) is the same regardless of which worksheet I’m referring to (“100_GCs”, “200_Permits”, etc.), which is why I’m only using VLOOKUP to grab the worksheet name.

Here is an example of the VLOOKUP function I’m using to grab the worksheet names:
=VLOOKUP($B$2,MAIN!B8:J56,9,FALSE)

Where:
* B2 is cell B2 on the “Bid Details” worksheet containing the ID per the table above (100, 200, etc.)
* “MAIN” is the worksheet name where these ID’s are associated with the worksheet names per the table above

And here’s the function (that isn’t working) with the VLOOKUP inserted in place of the hardcoded worksheet name:
=INDEX(VLOOKUP($B$2,MAIN!B8:J56,9,FALSE)!$P$12:$Q$40,MATCH(RIGHT(B4,3), VLOOKUP($B$2,MAIN!B8:J56,9,FALSE)!$Q$12:$Q$40),1)

I’ve tried this with numerous uses of single and double quotes around the VLOOKUP functions with no luck – I get the typical, generic popup window saying I have a problem with my function.

Thanks in advance for any suggestions!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Would Indirect work?

Code:
=INDEX(INDIRECT(VLOOKUP($B$2,MAIN!B8:J56,9,FALSE) & "!$P$12:$Q$40"),MATCH(RIGHT(B4,3), INDIRECT(VLOOKUP($B$2,MAIN!B8:J56,9,FALSE) & "!$Q$12:$Q$40")),1)
 
Upvote 0
Thanks, Kyle. I did try some versions of INDIRECT however I don't think I entered it as you have it shown. I'll try that and follow up this afternoon.
 
Upvote 0
Yes! That worked! I just learned about INDIRECT last week so was obviously not using it correctly in this scenario. Thanks for the help, Kyle. Have a great day.
 
Upvote 0

Forum statistics

Threads
1,215,521
Messages
6,125,302
Members
449,218
Latest member
Excel Master

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