How to reference a range of cells containing monthnameshort in GETPIVOTDATA

sko

New Member
Joined
Oct 28, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
  2. Web
I am trying to build a more agile and time limiting financial reporting tool. In this proces I stumpled upon a problem that I can't seem to fix.

I am trying to get Year-to-date numbers by referencing a range of cells containing Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep

Formula that works for january only:

=GETPIVOTDATA("[Measures].[Amount]";'Regnskab pr. mdr.'!$A$10;"[Dim GL Account Hierachy].[Parent GL Account]";"[Dim GL Account Hierachy].[Parent GL Account].&[1495 Nettoomsætning i alt]";"[Dim Posting Date].[MonthNameShort]";"[Dim Posting Date].[MonthNameShort].&[Jan]")

Here I want to refence a range of cells containing the months I want (jan to sep). I can't do it this simple:

=GETPIVOTDATA("[Measures].[Amount]";'Regnskab pr. mdr.'!$A$10;"[Dim GL Account Hierachy].[Parent GL Account]";"[Dim GL Account Hierachy].[Parent GL Account].&[1495 Nettoomsætning i alt]";"[Dim Posting Date].[MonthNameShort]";"[Dim Posting Date].[MonthNameShort].&[Jan]:[Sep]")

Alternatively I want to use a cell-range in the formula containing jan to sep, like sheet1!A1:A9

Does anybody know how to make this work?

Thanks a lot
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I suspect you'll need something like:

=SUM(GETPIVOTDATA("[Measures].[Amount]";'Regnskab pr. mdr.'!$A$10;"[Dim GL Account Hierachy].[Parent GL Account]";"[Dim GL Account Hierachy].[Parent GL Account].&[1495 Nettoomsætning i alt]";"[Dim Posting Date].[MonthNameShort]";"[Dim Posting Date].[MonthNameShort].&["&sheet1!A1:A9&"]"))

If any of the months might be missing, you'll need to wrap the inner GETPIVOTDATA in an IFERROR function too.
 
Upvote 0
Solution
Unfortunately it creates the #SPILL!

=GETPIVOTDATA("[Measures].[Amount]";'Regnskab pr. mdr.'!$A$10;"[Dim GL Account Hierachy].[Parent GL Account]";"[Dim GL Account Hierachy].[Parent GL Account].&[1495 Nettoomsætning i alt]";"[Dim Posting Date].[MonthNameShort]";"[Dim Posting Date].[MonthNameShort].&["&'Regnskab pr. mdr.'!D11:L11&"]")

And when I use the CTRL+SHIFT+ENTER it only grabs the value for Jan, and not the other months in the array.

Hmm.. Do you know if there is another way to grab the values from Jan to Sep in the GETPIVOTDATA above?
 
Upvote 0
That's not the formula I posted - you are missing the SUM function.
 
  • Like
Reactions: sko
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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