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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

pi

Board Regular
Joined
Apr 11, 2006
Messages
207
Really nobody? Is that request so absurd?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
37,550
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
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)
 
Solution

Forum statistics

Threads
1,143,687
Messages
5,720,293
Members
422,275
Latest member
Maria95

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
Top