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

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
  • 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 http://www.contextures.com/excel-pivot-table-calculated-field.html and Calculated Items http://www.contextures.com/excelpivottablecalculateditem.htm



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!
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel 201 rounding creating a problem with my macro 11 34
Excel Calculation 4 51
Need Help with Mapping ONLY 9 24
Records from Access to Excel to specific cells 5 25
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

860 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