Pivot table with dynamic sheet (!) reference

pi

Board Regular
Joined
Apr 11, 2006
Messages
207
There is a well know solution to use dynamic ranges as source of a pivot table (name using offset). In my case I want to take it one step further. I want to put the name of a sheet into a cell and derive the source of the pivot table from that.

Here is what I tried:

1: I have defined a name CurrentIC: =OFFSET(INDIRECT(ADDRESS(1;1;1;;Eval!$A$2));0;0;Eval!$C$2;Eval!$B$2)
Here Eval!$A$2 hast the sheet name, Eval!$C$2 the calculated height and Eval!$B$2 the calculated width of the table
This name actually works. If I enter it the correct table is displayed
2: I want to create a pivot table using CurrentIC as the source. Yet I get the message "Data source reference is not valid."

What do I do wrong? Any alternative approach to get to the desired result?

pi
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
It seems to just be too much indirection. This works for me:

Excel Formula:
=OFFSET(INDIRECT("'"&Eval!$A$2&"'!A1");0;0;Eval!$C$2;Eval!$B$2)
 
Upvote 0
Solution

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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