GETPIVOTDATA Get average of multiple fields that may or may not appear in a pivot table.

trikky

New Member
Joined
Dec 28, 2016
Messages
32
I have a pivottable that lists multiple fields, and has slicers for users and months (among other things). The fields on the table are:

Question 1
Question 2
Question 3
Question 4
Question 5

The pivottable's Value Field setting is for the average for each item presented as a percent. The source data includes stats from the entire YTD, but due to questions being added or rephrased, particular questions may not have results for individual months if we slice to specific months.

On my sheet that is doing the GETPIVOTDATA, I have two columns
Column 1 needs to get the average of Question 1 and Question 2
Column 2 needs to get the average of Questions 3, Question 4 and Question 5.

Unfortunately for some reason, when I to slice down to specific months, I'll get either nothing, or the value for one of the questions...but not necessarily the average of the combined values.

What I am looking for is a formula that will give me an average of the values - for example Question 3, Question 4 and Question 5, but if either of them is missing from the pivottable it still calculates and gives me the average of the remaining values.

I have tried the following arrays, but without success:
=IFERROR((AVERAGE(GETPIVOTDATA("Yes %",'Revised Pivot Tables'!$M$198,"Question",{"Question1","Question2"},"Common name",$B30),"")


=IFERROR((AVERAGE(GETPIVOTDATA("Yes %",'Revised Pivot Tables'!$M$198,"Question","Question1","Common name",$B30),(GETPIVOTDATA("Yes %",'Revised Pivot Tables'!$M$198,"Question","Question 2","Common name",$B30)))),"")


=IFERROR(GETPIVOTDATA("Yes %",'Revised Pivot Tables'!$M$198,"Question","Question1","Common name",$B30),(GETPIVOTDATA("Yes %",'Revised Pivot Tables'!$M$198,"Question","Question 2","Common name",$B30))),"")


=IFERROR(GETPIVOTDATA("Yes %",'Revised Pivot Tables'!$M$198,"Question","Question1","Common name",$B30)+(GETPIVOTDATA("Yes %",'Revised Pivot Tables'!$M$198,"Question","Question 2","Common name",$B30))),"")

Thank you in advance for any help you can provide.

Cheers.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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