0

I have a complex scorecard that I update monthly in Excel. For each datastream I have pivot tables generated from the data model. The scorecard is pretty dynamic and updates each cell based on row (month) and column (program) values. If I let Excel build the specific code I get the following which works:

=GETPIVOTDATA("[Measures].[PercentWSubstant]",IU_DDPivots!$A$5,"[Append3_Comp].[CountyOrIU]","[Append3_Comp].[CountyOrIU].&[County]","[Append3_Comp].[MonthApprovd]","[Append3_Comp].[MonthApprovd].&[10]")

I need to generalize the month approved portion so that it pulls from the second column of the worksheet. I searched around and found ways to reference a cell specifically, e.g.,

=GETPIVOTDATA("[Measures].[PercentWSubstant]",IU_DDPivots!$A$5,"[Append3_Comp].[CountyOrIU]","[Append3_Comp].[CountyOrIU].&[County]","[Append3_Comp].[MonthApprovd]","[Append3_Comp].[MonthApprovd].&["&MONTH(B27)&"]")

My ultimate goal is to replace that hard reference to B27 with a generalized RC2 reference so it works in whatever line the current cell occurs in. E.g.,

=GETPIVOTDATA("[Measures].[PercentWSubstant]",IU_DDPivots!$A$5,"[Append3_Comp].[CountyOrIU]","[Append3_Comp].[CountyOrIU].&[County]","[Append3_Comp].[MonthApprovd]","[Append3_Comp].[MonthApprovd].&["&MONTH('ScorecardData'!RC2)&"]")

I think I'm close but no matter what I do I get an Application Defined or Object Defined error when I run it.

Any help would be very much appreciated!

A.Birdman
  • 161
  • 1
  • 2
  • 12
  • Suggestion: `Debug.Print` the formula and inspect the output in the Immediate Window. I'm guessing your [quotes are off](https://stackoverflow.com/questions/9024724/how-do-i-put-double-quotes-in-a-string-in-vba). There may be additional issues. – BigBen Nov 16 '21 at 20:08
  • Thanks. I've been over them and it is definitely possible. I can't find it though. Not sure what the Debug.Print should provide. It gives me =GETPIVOTDATA("[Measures].[PercentWSubstant]",IU_DDPivots!$A$5,"[Append3_Comp].[MonthApprovd]","[Append3_Comp].[MonthApprovd].&["&MONTH(ScorecardData!RC2)&"]") – A.Birdman Nov 16 '21 at 21:06

0 Answers0