Help with GETPIVOTDATA #REF error

ExcelAtEverything

Active Member
Joined
Jan 30, 2021
Messages
351
Office Version
  1. 2019
Platform
  1. Windows
Pulling my hair out trying to figure out why this just pulls a #REF error instead of actually working. This formula is supposed to show the Avg Unit Price by dividing the monthly Gross Sales (GS$) by # of total items sold so far this month (GS Monthly). I know that it's the GETPIVOTDATA part that's not working correctly, but I haven't been able to figure out how to repair it.

Could someone help me to understand why this doesn't work? I used the same formula elsewhere in the "yesterday" section of the spreadsheet (out of view from the screenshot below), and it works flawlessly. The only change is the word "Yest" is changed to Monthly for this formula, because that Pivot Table is on a different tab. For this, thegreen/white table below is called "Month_To_Date". The Pivot Table below used in this formula is located on the "Item Totals Monthly" tab in a table called "Item_Tot_Monthly".

Thanks!

=IFERROR([@[GS$]]/GETPIVOTDATA("[Measures].[Sum of Quantity]",'Item Totals Monthly'!$B$3,"[Monthly Orders Reports].[Org #]","[Monthly Orders Reports].[Org #].&[" & [@[Org '#]] & "]"),"-")
1617470782957.png


1617470156471.png
 
Also, when I put that in, I get this error:
1617485148560.png

And then when I "x" out of that, I see this:

1617485208402.png
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hey Rory, I recognized that pattern of info around the Org # in your formula, and I replaced a small section of your formula with a portion of mart37's code (the correction is highlighted below), and now it works! Still trying to figure out the date portion to get rid of the April & 2021 references.

1617486518817.png
 
Upvote 0
The date is at the end. Remember we don’t have your workbook or a clear indication so far of exactly what data you are trying to return.
 
Upvote 0
Sorry, it looks like my iPad changed one of the quotes to curly quotes rather than regular ones.
 
Upvote 0
I totally understand. Trust me, you were the help I needed. Whatever you did toward the beinning was the fix that I couldn't figure out. I just used mart37's time/date fix as well, and now it works perfectly! Here is the final formula which is now working! Thx RoryA! (y) ?

=IFERROR([@[GS$]]/GETPIVOTDATA("[Measures].[Sum of Quantity]",'Item Totals Monthly'!$B$3,"[Monthly Orders Reports].[Org #]","[Monthly Orders Reports].[Org #].&["&[@[Org '#]]&"]","[Monthly Orders Reports].[Date (Month)]","[Monthly Orders Reports].[Date (Month)].&["&TEXT(TODAY()-1,"mmm")&"]"),"=")
 
Upvote 0
Solution
Rory, knowing that you are a moderator I have a question here. I want to checkmark your formula, even though it had an error and needed a couple of adjustments. You had limited info though, so I know how that goes. But that was still the basics of what led to the correct answer. Should I check your box? Or should you reply back with the ending formula so I can check the actual real correct formula? Or do I not check anything? What's the best thing to do in this scenario?
 
Upvote 0
Since you've posted the correct formula, you can just select that as the answer so that anyone coming to this thread later knows what to look at. :)
 
Upvote 0

Forum statistics

Threads
1,223,721
Messages
6,174,091
Members
452,542
Latest member
Bricklin

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