Forum Discussion

Juxta13's avatar
Juxta13
Copper Contributor
Sep 16, 2022

Excel pivot: Adding a summary percentage

I am working with categorical data - think of a survey with ratings from 1 to 5. In addition to the counts and grand total, I need to be able to add a percentage to summarize the top two categories.

 

Example (trying to add the %):

 PoorFairNeutralGoodExcellentTotal %Top 2
Jan3334417 47%
Feb1144515 60%
Mar  26917 88%
Apr1226516 69%
Total5611202365 66%

 

My true data includes several nested groupings in the rows, so it would make things much easier if I could add this into the pivot table rather than just having a manual calculation off to the right. That would accommodate new groupings that might appear or expanding/collapsing sub-grouping automatically.

 

I could easily add a column in my raw data to identify if the rating was in the top categories (1) or not (0). However, I am still unsure how to add it without having it nest within the rating categories. Ideas?

 

1 Reply

  • dscheikey's avatar
    dscheikey
    Bronze Contributor

    Juxta13 

    With the AGGREGATE() or the LARGE() function you can display the two top values and sum them up. Then just divide by the sum and make it a percentage.
    See also the enclosed document.

     

    =SUM(AGGREGATE(14,6,B2:F2,{1,2}))/SUM(B2:F2)

     

    It's not a pivot table. I hope you like it anyway.

    The LAGRGE() function leads to the same result.

    =SUM(LARGE(B2:F2,{1,2}))/SUM(B2:F2)

     

Resources