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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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