+ Reply to Thread
Results 1 to 6 of 6

Pivot table: Adding a % to summarize categories

  1. #1
    Registered User
    Join Date
    09-16-2022
    Location
    Chicago, IL
    MS-Off Ver
    MS365, Version 2202 (Build 14931.20660)
    Posts
    2

    Pivot table: Adding a % to summarize categories

    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 ad a percentage to summarize the top two categories.

    example.png

    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.

    sample.xlsx

  2. #2
    Valued Forum Contributor PeteABC123's Avatar
    Join Date
    09-21-2012
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 365 ver 2202
    Posts
    1,104

    Re: Pivot table: Adding a % to summarize categories

    Hi Juxta13: Welcome to the forum.

    You can insert a calculated field into the PT.

    https://www.contextures.com/excel-pi...ted-field.html

    Hope this gets you going.

    Go Bears.

    Pete

  3. #3
    Registered User
    Join Date
    09-16-2022
    Location
    Chicago, IL
    MS-Off Ver
    MS365, Version 2202 (Build 14931.20660)
    Posts
    2

    Re: Pivot table: Adding a % to summarize categories

    Unfortunately, that doesn't really help. I can create a field in the raw data itself to calculate which are in the top two categories. The problem is how to add it into the pivot table as a percentage - without having it nest within the other rating counts.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,562

    Re: Pivot table: Adding a % to summarize categories

    Perhaps using a calculated item:
    1. For 'Grand Total': ='1' +'2' +'3' +'4' +'5'
    2. For 'Top Two': =('4' +'5' )/'Grand Total'
    Two issues
    1. Each cell in H5:H8 has to be individually formatted using Format Cells as attempting to use Number Format changes the values in columns B:G to percentages as well
    2. The Grand Total of the 'Top Two' column is a sum of the percentages in H5:H8 instead of a percentage of (E9+F9)/G9
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: Pivot table: Adding a % to summarize categories

    Please try for Top 2 as a % of Total and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,562

    Re: Pivot table: Adding a % to summarize categories

    Here is another possibility that employs Power Pivot.
    1. Convert the data on the sample data sheet into an Excel table
    2. Add the table to the data model
    3. Produce the following measures
    Count Rating:=COUNT(tbl_Data[Rating])
    Count Top Two:=CALCULATE(COUNT(tbl_Data[Rating]),tbl_Data[Rating]>=4)
    Top Two:=[Count Top Two]/[Count Rating]
    4. Pull the Count Rating and Top Two fields into the Values area
    5. Number Format the Top Two field as Percentage
    Note that columns E, G, I, K and M are hidden as they display unnecessary (confusing) percentages.
    Let us know if you have any questions.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Summarize many categories on 1 pivot table
    By Ron Purpura in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 04-01-2016, 03:21 AM
  2. Use more than one summarize feature in pivot table
    By M_DACH in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-31-2014, 06:49 AM
  3. Replies: 1
    Last Post: 11-28-2014, 02:02 PM
  4. Summarize times in a pivot table
    By Mark@Marc in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-16-2005, 12:05 PM
  5. [SOLVED] Using Pivot Table Function to Summarize
    By David in forum Excel General
    Replies: 0
    Last Post: 07-08-2005, 12:05 AM
  6. Replies: 4
    Last Post: 04-19-2005, 10:06 PM
  7. How do I not summarize row data in a Pivot Table?
    By Alan Schenk in forum Excel General
    Replies: 0
    Last Post: 04-18-2005, 10:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1