Using =INDEX with Dynamic Sheets

blafarm

Board Regular
Joined
Oct 14, 2018
Messages
59
I need to dynamically fill select columns in a display sheet (DISPLAY) with select columns from a number of data sheets (D1, D2, D3, ...)

In the DISPLAY sheet, I have a list of friendly names in a column, with their associated data sheet names listed in a column directly to the right.

I am using a Data Validator in the DISPLAY sheet for the friendly names. And I am using INDEX & MATCH in order to populate cell A1 with the names of the actual desired data sheet ((D1, D2, D3, ...).

In the past, I have successfully used INDIRECT for this function, but I am precluded from using it for this application. When I have used it in the past to construct dynamic sheet references, I have used this technique to construct and reference the dynamic sheet:

=INDIRECT("'"&$A$1&"'!"&____) Cell A1 is the data sheet name.

However, this dynamic reference is not working with =INDEX, which requires a sheet name and reference range.

I have proven that I can get what I need with an absolute reference to the sheet like this:

=INDEX('D1'!A1:D50,0,1)

However, all attempts to construct something dynamic using =INDEX have failed, including this:

=INDEX("'"&$A$1&"'!"A1:D50,5,1)

With all of my attempted variations, Excel either won't accept the formula, or will return a #VALUE error.

I suspect my problem is related to the cell range which needs to be incorporated with the dynamic sheet name -- but I don't know what I am doing wrong.


Any assistance would be greatly appreciated.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
=index(indirect($a$1 & "!a1:d50"), 5, 1)
 
Upvote 0
INDIRECT is the function that makes text into a range reference, so no.

EDIT:
but I am precluded from using it for this application.
Missed that.
 
Last edited:
Upvote 0
Thanks again for your quick response.

I'm a bit of a novice, so please excuse this question if it make no sense.

We know that I can easily display the value of any cell in my data sheets, by simply pasting this equation into a cell of my display sheet:

=+'D1'!A1

Is there no other conditional function that allows me to replace the:

'D1'!

...with a text string from another cell?
 
Upvote 0
A way, perhaps;

Create a named formula ("myRange") Refers to:

=if(a1="Sheet1", Sheet1!A1:D50, if(a1="Sheet2", Sheet2!A1:D50, ...))
 
Last edited:
Upvote 0
Then the formula would be =index(myRange, whatever)

That would get tiresome if you needed a lot of them -- and assumes your converter supports named formulas.
 
Upvote 0
Ok, so if I am understanding you correctly, I think you are suggesting:

1. Give a new cell in my display sheet (A2 for example) the name of "myRange"

2. Insert the formula you supplied directly above

3. Modify my original formula in my desired cells so that it looks like this: =INDEX("myRange,5,1)

Did I get that right?
 
Upvote 0
No.

Go to Name Manager and create a name called myRange. Then use that formula to define it.

Sorry, I should have written that formula as: =INDEX("myRange",5,1)

No; =INDEX(myRange,5,1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,537
Messages
6,120,096
Members
448,944
Latest member
SarahSomethingExcel100

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