GETPIVOTDATA returns 0 when one item from list missing

bradams

New Member
Joined
Oct 23, 2012
Messages
40
=IFERROR(SUM(GETPIVOTDATA("Count of Age",Pivots!O$3,"Case Type",Cases!$B$4,"Age",{13,14,15,16,17})),0)

In my current data set there is nobody age 16 and the formula returns 0 even though there are kids age 13, 14, etc. The formula works fine if I take 16 out of the condition array. But the next time I run it there may be somebody age 16 and maybe there won't be anybody age 17. So how do I change the formula so it ignores missing values? I'm assuming it has something to do with the IFERROR function but not sure how to fix it. The only guess I have is to do a series of single age lookups like this:

=IFERROR(GETPIVOTDATA("Count of Age",Pivots!O$3,"Case Type",Cases!$B$4,"Age",13),0)+IFERROR(GETPIVOTDATA("Count of Age",Pivots!O$3,"Case Type",Cases!$B$4,"Age",14),0)

Is there any easier way?
 
Last edited:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Perhaps:


=SUM(IFERROR(GETPIVOTDATA("Count of Age",Pivots!O$3,"Case Type",Cases!$B$4,"Age",{13,14,15,16,17}),0))
 
Upvote 0
I apologize for the delay in responding. I was out of the office for a few days and just now got a chance to test your suggestion. It appears to have solved my problem! Thank you very much!
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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