• Status: Solved
• Priority: Medium
• Security: Public
• Views: 923

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

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!
0
Jarred Meyer
• 4
• 3
1 Solution

Finance AnalystCommented:
You can include the field twice (2007 and later) and set the second field as "Show As Percentage of Total" in the field settings.

Thanks
Rob H
0

Commented:
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)

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

Enjoy!

Dave
funWithCalculatedFields.xlsx
0

Production ManagerAuthor Commented:
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!
INSPECTION-LOG-2011.xlsm
0

Commented:
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:

Dave
0

Commented:
Here's the attached file :)

Dave
INSPECTION-LOG-2011-r1.xlsm
1

Production ManagerAuthor Commented:
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..
0

Commented:
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.

Dave
1

Production ManagerAuthor Commented:
Got it all set up! Thanks a bunch for the help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.