Using choose/match in place of Indirect

elk03

Board Regular
Joined
Jan 30, 2020
Messages
98
Office Version
  1. 2019
Hi,

I currently have a formula using INDIRECT but was hoping to use Choose and Match in place to keep spreadsheet fast. This is my current formula below, where H2 is the current name of the worksheet I want to reference. I want to variably change the worksheet reference based on H2. Thanks for the help!


=VLOOKUP(B3,INDIRECT("'"&H2&"'!"&"A:S"),19,0)
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try...

=VLOOKUP(B3,CHOOSE(MATCH(H2,{"Sheet1","Sheet2"},0),'Sheet'1!A:R,'Sheet2'!A:S),19,0)

Change and/or add sheet names, along with their corresponding references, accordingly.

Hope this helps!
 
Upvote 0
Solution
You're very welcome, glad I could help.

Cheers!
 
Upvote 0
Hi, I was wondering if in the Match function, for "Sheet1" and "Sheet2" to use a cell refence? I get an error message when trying to.

=VLOOKUP(B3,CHOOSE(MATCH(H2,{"Sheet1","Sheet2"},0),'Sheet'1!A:R,'Sheet2'!A:S),19,0)
 
Upvote 0
Sure, let's say that J2 and J3 contain the sheet names Sheet1 and Sheet2, respectively...

=VLOOKUP(B3,CHOOSE(MATCH(H2,$J$2:$J$3,0),'Sheet1'!A:R,'Sheet2'!A:S),19,0)

By the way, you had a single quote in the wrong place. Also, if you want the references to your lookup tables to be absolute...

=VLOOKUP(B3,CHOOSE(MATCH(H2,$J$2:$J$3,0),'Sheet1'!$A:$R,'Sheet2'!$A:$S),19,0)

Hope this helps!
 
Upvote 0
Thanks for the reply. It does not seem to pull the correct sheet reference without the array part { } it seems like? All the months are pulling in differently than the one referred.
 
Upvote 0
=VLOOKUP($B3,CHOOSE(MATCH(D$1,$G$14:$G$19,0),'Aug MT'!$A:$S,'Jul MT'!$A:$S,'Jun MT'!$A:$S,'May MT'!$A:$S,'Oct MT'!$A:$S,'Sep MT'!$A:$S),19,0)

Its pulling data for the wrong month based on D1.
 
Upvote 0
What value does D1 contain?

And what values does G14:G19 contain?
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

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