Using Cell Reference in GETPIVOTDATA

BiggusDoggus

Board Regular
Joined
Jul 7, 2014
Messages
91
Office Version
  1. 365
Platform
  1. Windows
Hi all

I have scoured Google (including this site) and can't find the answer to this - there have been solutions given to other people that just don't work for me.

I have this formula:

=GETPIVOTDATA("[Measures].[Sum of Actuals]",'2017 Calc'!$A$3,"[Range 1].[Order Date (Month)]","[Range 1].[Order Date (Month)].&[Mar]","[Range 1].[Region]","[Range 1].[Region].&[Bay of Plenty]")/GETPIVOTDATA("[Measures].[Sum of Actuals]",'2017 Calc'!$A$3,"[Range 1].[Order Date (Month)]","[Range 1].[Order Date (Month)].&[Mar]")

Now, what I'm wanting to be able to do is replace the values in bold with cell references. For example, "Mar" to be replaced with E2, and "Bay of Plenty" with B4. The table with the formulas is going to be sizeable, and likely to have dynamic values in the Region (column B). And it's sizeable - I really don't want to have to go in and manually change the Region if it varies!

Any help greatly appreciated thanks!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi !

The following should do the trick:

=GETPIVOTDATA("[Measures].[Sum of Actuals]",'2017 Calc'!$A$3,"[Range 1].[Order Date (Month)]","[Range 1].[Order Date (Month)].&[" & A2 &"]","[Range 1].[Region]","[Range 1].[Region].&["& B2 &"]")/GETPIVOTDATA("[Measures].[Sum of Actuals]",'2017 Calc'!$A$3,"[Range 1].[Order Date (Month)]","[Range 1].[Order Date (Month)].&["& A2 & "]")

Make sure to start with quotation " , then use & sign, then add a cell reference and then & sign again, and end with quotation " again.

Let me know if it works! Good luck!

Rick
 
Upvote 0
Hi Rick, thanks for that.

But unfortunately no, getting #REF . Just for validation, here is what I've used:
=GETPIVOTDATA("[Measures].[Sum of Actuals]",'2017 Calc'!$A$3,"[Range 1].[Order Date (Month)]","[Range 1].[Order Date (Month)].&[" & A2 &"]","[Range 1].[Region]","[Range 1].[Region].&[" & B2 &"]")/GETPIVOTDATA("[Measures].[Sum of Actuals]",'2017 Calc'!$A$3,"[Range 1].[Order Date (Month)]","[Range 1].[Order Date (Month)].&[" & A2 &"]")
 
Upvote 0
I've worked around the issue by changing the setting so that Excel stops using the GETPIVOTDATA functions, and am using INDEX MATCH instead. Thanks for your help though, Rick!
 
Last edited:
Upvote 0
He Biggus,

Index Match is definitely a working alternative.

If you want to continue the GETPIVOTDATA formula anyway I usually track the formula error as follows:
First I select the cell in the pivot I need. Excel will create the GETPIVOTDATA formula automatically. Then I change the first part of the formula that I want to make dynamic. If that works, the second part etc.

One source of problems could be referring to a date. You may want to refer to the month March, and link to a cell containing a date, formatted as month. In reality, the GETPIVOTDATA may not ask for a DATE field, but a TEXT field with "Mar". Changing the formatting of the cell I make a reference to from date to TEXT then sometimes is the solution.

Anyway, Great you got it working. If you need anymore help you can always send me an excel file and I'll have a look at it.

Cheers,
Rick
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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