GETPIVOTDATA #Ref error

spreadsheet

New Member
Joined
Apr 14, 2011
Messages
2
Hi,

I have a pivot table scenario where the column and row categories dissappear when filtering by month for example. I understand that part.

However, I am trying to use the 'getpivotdata' command to populate a report using specific cells. This works fine until one of these fields doesn't exist for one month (though it does exist elsewhere in the data table).

Is there a way to alter the getpivotdata formula to return zero instead of an error when an item does not exist at a filtered level.

My long solution was to put the GETPIVOTDATA formula off to the side in another cell, than put an ISERROR formula in the next cell, than put an IF formula in the report cell stating if the ISERROR is TRUE, enter 0, else ref the GETPIVOTDATA cell.

A B C D
1 Sales IF(c1=TRUE,0,=d1) ISERROR(d1) GETPIVOTDATA


There has to be an easier way.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Why don't you combine ISERROR within the GETPIVOTDATA macro. Hope this works.

=IF(ISERROR(GETPIVOTDATA("xxxx")),0,(GETPIVOTDATA("xxxx"))
 
Upvote 0
THANKS!

That works. I was trying to nest it with the IF + ISERROR, but was evidently not getting my logic correct. This was a big help.

:beerchug:

I joined yesterday and already got a great answer. Pretty cool.
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,348
Members
452,907
Latest member
Roland Deschain

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