How to automate getpivotdata formula?

iambadatexcel

New Member
Joined
Apr 30, 2015
Messages
18
Hi all, I am new to the forum and am hoping that I could get some help!

I am trying to pull data out of a pivot table, and below is my formula.

=GETPIVOTDATA("[Measures].[Occ]",'BI-Occ'!$A$5,"[Market].[Market Code]","[Market].[Market Code].&[BAR]","[Dates].[Day]","[Dates].[Day].&[3]","[Dates].[Month]","[Dates].[Month].&[1]","[Dates].[Year]","[Dates].[Year].&[17]")

The problem I am having is that I am unable to drag the cell as it returns the same value. I need to change the numbers in here "[Dates].[Day].&[3]" such that I am able to have the number 1 2 3 4 5 and so forth in the brackets. Is there any kind soul who could help me figure out? ><

Thank you in advance!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Is there a cell you can reference instead of "[Dates].[Day].&[3]"? For instance if the 1,2,3,4,5 are in column A in the pivot, change the getpivotdata function to say $A1 to reference that cell instead...and when you drag the formula it will adjust the $A1 to $A2, $A3, etc. to pull the value of the number instead of the location.
 
Upvote 0
To start from 1:

=GETPIVOTDATA("[Measures].[Occ]",'BI-Occ'!$A$5,"[Market].[Market Code]","[Market].[Market Code].&[BAR]","[Dates].[Day]","[Dates].[Day].&["&ROWS($A$1:$A1)&"]","[Dates].[Month]","[Dates].[Month].&[1]","[Dates].[Year]","[Dates].[Year].&[17]")

which will increment as you copy it down.
 
Upvote 0
Glad to help. :)
 
Upvote 0

Forum statistics

Threads
1,215,197
Messages
6,123,581
Members
449,108
Latest member
rache47

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