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
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I'm not sure how you're seeing a #REF error with that IFERROR in place.
 
Upvote 0
Hi RoryA!:) Yes, you're correct, my apologies. I removed the IFERROR part while I was working on trying to figure it out, and I guess I mistakenly took the screenshot after I replaced it rather than before. Sorry about that!:oops: So to sum up, if you remove the IFERROR portion, it gives a #REF error.
 
Upvote 0
If you create a static getpivotdata formula for that cell, what does it look like?
 
Upvote 0
If you create a static getpivotdata formula for that cell, what does it look like?
=GETPIVOTDATA("[Measures].[Sum of Quantity]",'Item Totals Monthly'!$B$3,"[Monthly Orders Reports].[Org #]","[Monthly Orders Reports].[Org #].&[237]","[Monthly Orders Reports].[Date (Month)]","[Monthly Orders Reports].[Date (Month)].&[Apr]","[Monthly Orders Reports].[Date (Year)]","[Monthly Orders Reports].[Date (Year)].&[2021]")
 
Upvote 0
As you can see, you are missing a lot of required field info in your original version.
 
Upvote 0
Definitely. So... I was trying to make it so that when I dragged the formula down, it translated correctly. I also needed to make the Org # "237" dynamic. The parts that I pasted in worked in the original formulas that I got them from (courtesy of the awesome mart37 on MrExcel). But there is ceertainly the possibility that I'm doing it incorrectly, hence why I asked for the assistance. I can't seem to get these correct. I moved them to where they made sense to me, for what I believe they are doing. I made those transitions in several other columns correctly after going through a few attempts. Just can't seem to get this one & feel like I'm way off.
 
Upvote 0
I've posted several of these for the columns I can't get right on my own, and mart37 has been grabbing almost all of them and hooking me up. This is one that I tried on my own based on some of his formulas. If that makes sense I hope. Lol
 
Upvote 0
Assuming the Org number is what changes as you drag down, it would be:

=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)].&[Apr]","[Monthly Orders Reports].[Date (Year)]","[Monthly Orders Reports].[Date (Year)].&[2021]")
 
Upvote 0
Sorry if this is a dumb question, but what about the date? What about when 2022 arrives?
 
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