how to calculate a percentage of a count in a Pivot table in Excel 2010

Posted on 2011-09-08
Last Modified: 2012-05-12
On Sheet 1 I have a Table set up. It's called Table1. It has a list of parts that had inspections performed on them, and whether or not they passed or failed. On Sheet two, I have a pivot table set upt that looks at Table1 and displays a Count of Inspections grouped per month and a count of Failed Inspections.

It looks like this
So I want to know if I can add another field to the right of Failed Inspections (currently where I have dragged in another Count of P/F) that will tell me what percentage that is of the total number of inspections for that month?

Thanks in advance for the help!
Question by:SeyerIT
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 33

Expert Comment

by:Rob Henson
ID: 36503035
You can include the field twice (2007 and later) and set the second field as "Show As Percentage of Total" in the field settings.

Rob H
LVL 42

Expert Comment

ID: 36508303
I created a mock-up of what you have.  You have everything you need in the pivot table with Number of Inspections and Number of Failures to create the Failure % Ratio, and have it dynamically update when the PivotTable is refreshed.

See the image below.  Just select on a cell in the Number of Failures column (see active cell, below) - it can be anywhere in the Values section.

Then, above in the PivotTable Tools Ribbon, just select "Fields, Sets, & Items", then "Calculated Field"

You'll want to add a new field, ex., Inspections_Failed% with a formula like:

= IF(Inspection =0,0,'Num Failures' /Inspection)

Selecting Calculated Field Menu item from PivotTools Developer Ribbon
Creating Calculated Field to Show Ratio
See attached demo workbook.

Also, you might enjoy this link - more on Calculated Fields and Calculated Items



Author Comment

ID: 36509981
This definitely looks like what I'm trying to do, however, I can't seem to get it to work on my spreadsheet.. I know my data is set up slightly differently but seems like that shouldn't matter.. I have a list of individual inspections and the pivot is doing a count of one of the columns (WO/LOT#) to determine how many inspections were completed and then it is counting the number of these that have an "f" in the P/F column to determine the count of failures.. I'm uploading a dummied down copy of my spreadsheet, perhaps you could take a look at it for me?

Thanks a bunch for the help Dave!
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 42

Accepted Solution

dlmille earned 500 total points
ID: 36512722
Calculated Fields/Items don't work well on aggregates.  But we can help that with a couple helper columns in the source data.  I created two fields in your table that count the # of inspections (just an =1) and # of failures (=IF(Table1[[#This Row],[P/F]]="F",1,0)

Calculated Field            
1      cInspection_Failures%      =IF('HelpInsp#'=0,0,'Help Fails'/'HelpInsp#')
See attached, for an output like:
 Example output
LVL 42

Expert Comment

ID: 36512728
Here's the attached file :)


Author Comment

ID: 36512776
This looks great.. I will try to reproduce all of it here in a minute.. Just wrapping up another task really quick.. One quick question, How do you delete a calculated field from the pivot in it's entirety? Or modify it? i can't seem to figure it out..
LVL 42

Expert Comment

ID: 36512833
Go to the calculated field menu (PivotTools->etc.->Calculated Field).  There's a dropdown where you type in the name of the new field, just toggle to find an existing one, where you have the option to MODIFY or DELETE.


Author Comment

ID: 36513021
Got it all set up! Thanks a bunch for the help!

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question