using a named range in another worksheet with INDIRECT

geordz

New Member
Joined
Apr 13, 2010
Messages
42
evening all,
Hoping some kind person can help me out. I have created a drop down list in 'sheet1' (cell T4) and a variable in A2 that I am performing a VLOOKUP for inanother sheet. The sheet that the VLOOKUP is performed in depends on what is selected in the drop down list ie 'Sheet2', 'sheet3', etc

=VLOOKUP($A$2,INDIRECT("'"&T$4"'!A6:I16"),2,FALSE)

all is working well however, within 'sheet1', 'sheet2' etc I have named the range A6:I16 as 'FP'. I have another range A17:I27 named 'N_1' and a few others. This is so I can create another drop down list in T5 that will have the list 'FP', 'N_1' etc. Is it possible to have both the sheet and range defined dynamically in the INDIRECT function? If so how do I ammend the function above please?

hope that made sense

any help much appreciated

dave
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Thank you so much for the reply. That is a great help.

Can you explain the syntax of starting with " ' " and ending with ' "! when you are referencing a sheet? Why is there another set of quotes after the ! ?

The syntax of referencing things using this indirect function is baffling me.

thanks again

dave
 
Upvote 0
Cells T4 and T5 contain variable data, which you want the formula to reference whenever it is calculated. When using INDIRECT, anything within quotation marks will stay the same. Broken down:

"'" will create the first apostrophe before the sheet name.
&T4 will concatenate the value in T4 to that apostrophe.
&"'!" will concatenate an apostrophe and exclamation point after the sheet name.
&T5 will concatenate the value in T5 (named range in this case).

If you kept T4 and T5 within the quotes, it will assume you meant them literally and the formula would become something like:

=VLOOKUP($A$2,'T4'!T5,2,0)

instead of

=VLOOKUP($A$2,'Sheet7'!N_1,2,0)
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,908
Members
452,949
Latest member
beartooth91

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