Sumifs issue or pivot issue... Help please

excel_1317

Board Regular
Joined
Jun 28, 2010
Messages
212
I have thousands of rows like below. I need to make a pivot for below data based on parent name. Now survey count in pivot shows as 48 which is wrong. If i do average, it gives me 7.4 and using max give me 10. But the correct survey count for ABC Corp. is 14(10+4). How can this be achieved in pivot, may be adding a helper column in the data? My solution is to bring 14 as survey count corresponding to ABC corp. in pivot. Excel masters please help

Parent NameSurvey idSurvey Count
ABC Corp0123
10​
ABC Corp0123
10​
ABC Corp
ABC Corp0123
10​
ABC Corp0456
4​
ABC Corp0456
4​
ABC Corp0456
4​
ABC Corp0123
10​
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try using both parent name and survey id in the pivot row box.
 
Upvote 0
Like this then?
zgadson 21-7-20.xlsx
ABCDEFG
1Parent NameSurvey idSurvey CountHelperRow LabelsSum of Helper
2ABC Corp123102.5ABC Corp14
3ABC Corp123102.5Grand Total14
4ABC Corp 
5ABC Corp123102.5
6ABC Corp45641.3333333
7ABC Corp45641.3333333
8ABC Corp45641.3333333
9ABC Corp123102.5
Sheet9
Cell Formulas
RangeFormula
D2:D9D2=IFERROR(C2/COUNTIFS(A:A,A2,B:B,B2),"")
 
Upvote 0
Thanks @jasonb75. Your solution perfectly did the job. But now I got an additional requirement. Column E has NPS scores for every survey id that corresponds to parent ABC Corp. If I drag NPS to pivot table, it simply takes an average which comes to 73% and that is incorrect. This should be weighted average based on survey id and survey count. Correct weighted average comes to 69% which I calculated in cell I6.

Can this be achieved in pivot table? NPS for ABC Corp should be shown as 69% in pivot table instead of 72%.


Book2.xlsx
ABCDEFGHIJK
1Parent NameSurvey idSurvey CountHelperNPS
2ABC Corp0123102.50.628571Row LabelsSum of HelperAverage of NPS
3ABC Corp0123102.50.628571ABC Corp1473%
4ABC Corp Grand Total140.726530612
5ABC Corp0123102.50.628571
6ABC Corp045641.3333330.857143Weighted NPS for ABC Corp69%
7ABC Corp045641.3333330.857143
8ABC Corp045641.3333330.857143
9ABC Corp0123102.50.628571
Sheet3
Cell Formulas
RangeFormula
I6I6=((C2*E2)+(C6*E6))/(C2+C6)
D2:D9D2=IFERROR(C2/COUNTIFS(A:A,A2,B:B,B2),"")
 
Upvote 0
Try this formula in K3, must be array confirmed with Ctrl Shift Enter (if not done correctly the result will come out at 11%)

=SUMPRODUCT(IFERROR(($A$2:$A$9=I3)*$D$2:$D$9*$E$2:$E$9,0))/J3
 
Upvote 0
Sorry, K3 is pivot cell. I2:K4 is pivot table. Like you added an helper column in main data for survey count, can a helper column be added to calculate NPS in pivot table correctly?
 
Upvote 0
It might be possible, but everything I try gives an incorrect result. Removing the column from the pivot and using formulas instead works fine.
 
Upvote 0
Yes, the formula you suggested gives accurate result but I have approx 5000 parents with approx 60k rows of data. If i put put formula outside pivot table and end user filters the pivot on parent name then it will be a a problem.
 
Upvote 0
Try this one in a helper column, then SUM that column in the pivot.

=IFERROR(D2*E2/SUMIF(A:A,A2,D:D),"")
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,981
Members
449,058
Latest member
oculus

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