Problem with Dynamic Range Reference to Pivot Table Array

InfrequentVisitor

New Member
Joined
Mar 30, 2016
Messages
28
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello,

The Background:
I'm currently working with a pivot that is drawing information from a query. The query's number of rows change, so the pivot's does, as well. The number of columns won't change anytime soon.

The pivot is located in the CBPivot tab. I'm using Index/Match to pull the information from the pivot into a cell:
=INDEX(CBPivot!$B$3:$BP$11803,MATCH($C30,CBrow,0),MATCH(F$29,CBcolumn,0))

Where CBrow & CBcolumn are offset functions to adjust the row & column references as the pivot changes size.
CBrow = OFFSET(CBPivot!$A$3,0,0,COUNTA(CBPivot!$A:$A)-1,1)
CBcolumn = OFFSET(CBPivot!$B$2,0,0,1,COUNTA(CBPivot!$2:$2)-1)

The Question:
Is there a way (preferably with formulas over VBA, but I'll use VBA, if needed) to make the array reference CBPivot!$B$3:$BP$11803 in the INDEX function dynamic, so that it changes with the pivot's size?

- Thank you
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Have you considered using a GetPivotData formula that has relative references to your Row and Column lookup values?

One benefit of the GetPivotData function is that you only need to reference one cell on the PivotTable so you can reference the static cell CBPivot!$A$2.
 
Upvote 0
Have you considered using a GetPivotData formula that has relative references to your Row and Column lookup values?

One benefit of the GetPivotData function is that you only need to reference one cell on the PivotTable so you can reference the static cell CBPivot!$A$2.

Mr. Sullivan,

After some trial & error with your suggestion, I can say that is the perfect fix to my problem.

Much obliged.

- Eric
 
Upvote 0

Forum statistics

Threads
1,226,730
Messages
6,192,708
Members
453,748
Latest member
akhtarf3

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