ABOUT PIVOTTABLES TABLE OF CONTENTS

Similar documents
Excel Tables & PivotTables

Excel 2007/2010. Don t be afraid of PivotTables. Prepared by: Tina Purtee Information Technology (818)

Creating a Pivot Table

Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts. Microsoft Excel 2013 Enhanced

New Perspectives on Microsoft Excel Module 5: Working with Excel Tables, PivotTables, and PivotCharts

The subject of this chapter is the pivot table, the name given to a special

Microsoft Excel Pivot Tables & Pivot Table Charts

Microsoft Excel 2013/2016 Pivot Tables

Excel 2013 PivotTables and PivotCharts

Excel Tables and Pivot Tables

To complete this workbook, you will need the following file:

Chapter at a glance. Analyze. Filter. Format. Create. Analyze data dynamically by using PivotTables, page 288

GO! with Microsoft Excel 2016 Comprehensive

Data Should Not be a Four Letter Word Microsoft Excel QUICK TOUR

Microsoft Excel Pivot Tables & Pivot Table Charts

Excel Advanced

Les s on Objectives. Student Files Us ed. Student Files Crea ted

Pivot Tables in Excel Contents. Updated 5/19/2016

DESCRIPTION 1 TO DEFINE A NAME 2. USING RANGE NAMES 2 Functions 4 THE IF FUNCTION 4 THE VLOOKUP FUNCTION 5 THE HLOOKUP FUNCTION 6

Pivot Tables and Pivot Charts Activities

Excel Introduction to Excel Databases & Data Tables

Table of Contents. 1. Creating a Microsoft Excel Workbook...1 EVALUATION COPY

Creating Automated Dashboard Excel 2013 Contents

Excel 2013 Part 2. 2) Creating Different Charts

EXCEL ADVANCED Linda Muchow

M i c r o s o f t E x c e l A d v a n c e d P a r t 3-4. Microsoft Excel Advanced 3-4

Excel 2007 New Features Table of Contents

Contents. The basics. Filling Cells A cell can contain: Text, Numbers or formulas

Excel Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts. 6. You can use a table s sizing handle to add columns or rows to a table.

How to Create and Use a Pivot Table in Excel

Formulas, LookUp Tables and PivotTables Prepared for Aero Controlex

Introduction to Microsoft Excel 2010

Excel 2010: Getting Started with Excel

Pivot Table Project. Objectives. By the end of this lesson, you will be able to:

Intermediate Microsoft Excel 2010

Microsoft Excel 2010 Handout

2013 ADVANCED MANUAL

Excel Tips for Compensation Practitioners Weeks Pivot Tables

Microsoft Excel 2010 Step-by-Step Exercises PivotTables and PivotCharts: Exercise 1

EXCEL TUTORIAL.

Introduction to Microsoft Excel 2010

Export a PROTECT Report to Excel (User s Guide Lesson 21 : Reports) Tips for Using Microsoft Excel and Exported Reports

1. What is a PivotTable? What is a Cross Tab Report?

Teach yourself... PivotTables and PivotCharts. with. Microsoft Excel Easy to follow Step-by-step instructions Written in plain English

Quick Guide for Excel 2015 Data Management November 2015 Training:

INFORMATION TECHNOLOGY 402 UNIT IV SPREADSHEET

MICROSOFT EXCEL BEYOND THE BASICS. MARY ANN WALLNER Contact Information:

Sample Chapters. To learn more about this book, visit the detail page at: go.microsoft.com/fwlink/?linkid= Copyright 2010 by Curtis Frye

Index. C calculated fields, vs. calculated items, 56 correcting results in, 67 creating, 61 count of unique items, 66

File Name: Pivot Table Labs.xlsx

Patricia Andrada Quick Guide Excel 2010 Data Management-July 2011 Page 1

File Name: Data File Pivot Tables 3 Hrs.xlsx

CHAPTER TWO: SPREADS HEETS WITH EXCEL 1

NUMERICAL COMPUTING For Finance Using Excel. Sorting and Displaying Data

Starting Excel application

Microsoft Excel 2010 Tutorial

Intermediate Excel 2016

Excel 2010-Part. Two

SUM - This says to add together cells F28 through F35. Notice that it will show your result is

Excel Foundation Quick Reference (Windows PC)

COURSE CONTENT EXCEL BASIC ONE DAY

Intermediate Excel Training Course Content

PivotTables & Charts for Health

SPREADSHEET (Excel 2007)

ASMC Professional Development Institute, Anaheim, CA. Teksouth Corp.

How to Excel - Part 2

GCSE CCEA GCSE EXCEL 2010 USER GUIDE. Business and Communication Systems

Learning Microsoft Excel Module 1 Contents. Chapter 1: Introduction to Microsoft Excel

Mathematical Operators for Excel

INSERT SUBTOTALS Database Exercise Sort the Data Department Department Data Tab Sort and Filter Group

Timecard history can be queried for a number of valuable reports. Begin by accessing the his_timecard table in a query.

Excel Level 1

Microsoft Excel for Lawyers - The Fundamentals Reference Guide

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013

THE POWER OF PIVOT TABLES

WHY USE EXCEL? KEY EXCEL TERMINOLOGY

Gloucester County Library System. Excel 2010

Microsoft Excel 2007

Working with Charts Stratum.Viewer 6

Office of Instructional Technology

Creating a Spreadsheet by Using Excel

MICROSOFT Excel 2010 Advanced Self-Study

EXCEL 2003 DISCLAIMER:

EVALUATION COPY. Unauthorized Reproduction or Distribution Prohibited EXCEL INTERMEDIATE

Excel. Excel Options click the Microsoft Office Button. Go to Excel Options

1. Two types of sheets used in a workbook- chart sheets and worksheets

Learning Microsoft Excel Module 1 Contents. Chapter 1: Introduction to Microsoft Excel

THE EXCEL ENVIRONMENT... 1 EDITING...

Homework 1 Excel Basics

SmartView. User Guide - Analysis. Version 2.0

Chapter-2 Digital Data Analysis

råáîéêëáíó=çñ=pçìíüéêå=`~äáñçêåá~ Academic Information Services Excel 2007 Introduction to Excel

Designed by Jason Wagner, Course Web Programmer, Office of e-learning NOTE ABOUT CELL REFERENCES IN THIS DOCUMENT... 1

Chapter 4. Microsoft Excel

Application of Skills: Microsoft Excel 2013 Tutorial

Microsoft Excel Microsoft Excel

Math 2524: Activity 1 (Using Excel) Fall 2002

COMP1000 / Spreadsheets Week 2 Review

Working with Microsoft Excel. Touring Excel. Selecting Data. Presented by: Brian Pearson

Project 4 Financials (Excel)

Transcription:

University of Southern California Academic Information Services Excel 2007 - PivotTables ABOUT PIVOTTABLES PivotTables provide an excellent means of analyzing data stored in database format by rearranging and summarizing the data into a matrix. The data in the top image below shows our Movies database. Below it is the same data rearranged into a matrix by Category and Rating. For example, in the intersection of the G column with the Comedy row is the number $275,312,660. This is the total profit made by all G rated comedies. The rightmost column contains the grand total for each category and the bottom row contains the grand totals for each rating. TABLE OF CONTENTS TABLE OF CONTENTS... 1 ABOUT PIVOTTABLES... 1 Parts of a PivotTable... 3 Example: Rating & Category Matrix... 4 FILTERING... 6 Clearing a Specific Filter... 7 Clearing All Filters... 7 Clear all Fields, Formatting, & Filters from a Pivot Table... 7 EXTRACT HIDDEN RECORD DETAILS TO A NEW SHEET (DRILL DOWN)... 7 SORTING... 8 Sort by Row or Column Label in Ascending or Descending Order... 8 Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 1 of 39

Sort Values by a Specific Column... 9 Sort by Grand Totals (Column or Row)... 9 CHANGING THE MATHEMATICAL OPERATION (SUMMARIZE BY)... 10 GROUP INTERVALS - DATES... 11 Ungroup... 11 GROUP INTERVALS NUMBER FIELDS... 12 Place a Space between Groups / Hide Subtotals... 13 CREATE SUBGROUPS BY COMBINING LABELS... 13 Hide/Display Grand Totals... 14 CREATE MULTIPLE SUMMARY CALCULATIONS IN COLUMNS... 15 CREATE MULTIPLE SUMMARY CALCULATIONS BY ROW... 16 PIVOT TABLES ADVANCED MATHEMATICAL OPERATIONS... 17 Example: Difference From... 18 Example: Percent Difference From... 19 Example: Percent Of... 20 Example: Running Total... 21 Example: % of Row... 22 Example: % of Column... 23 Example: Percent of Total... 24 Example: Indexing... 25 Update PivotTables When the Database is Edited... 26 Update PivotTables When the Rows are Added to a Database... 26 REFRESHING YOUR PIVOTTABLE WHEN THE DATABASE CHANGES... 26 Update PivotTables When the Rows are Added to a Table... 26 PIVOTTABLE FORMULA FIELDS (CALCULATED FIELDS & ITEMS)... 27 Example 1: Calculated Field... 27 Example 2: Beware of Subtotals and Grand Totals with Calculated Fields... 29 Example 3: Calculated Item... 31 Editing a Calculated Field or Item... 33 USING THE SAME FIELD IN BOTH COLUMN AND ROW LABELS... 34 PIVOTTABLE DESIGN OPTIONS... 35 PIVOTTABLE CHARTS... 36 Creating a PivotChart... 36 PivotChart Example 1: Pie Charts... 37 Formatting the Chart... 37 PivotChart Example 2 Bar, Line, Area, & Column Charts... 38 Changing Chart Type (Line, Bar, Column, & Area)... 39 Moving the Chart... 39 Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 2 of 39

Parts of a PivotTable Some of the different areas of a PivotTable are shown below. Note that many area are optional. You do not have to have both column and row fields as the image shows and you do not have to display the grand totals either. Further, the image below shows subgroups which, along with column subgroups, are also optional. Report Filter Report Filter Item Column Field Data Field Row Fields (Category is a subfield of Rating) Data Area Items The PivotTable shown above was created by laying out the fields using Excel s PivotTable Field List tool which is shown to the right. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 3 of 39

Example: Rating & Category Matrix In this example, we will create the pivot table shown below. We are using Ratings as Column Labels, Categories as Row Labels, and Profit in our Data Area. 1. Click on the Movies sheet. 2. Click anywhere within the database (cell C15 for example). 3. Click the Insert tab. 4. Click the PivotTable drop down and select PivotTable. 5. Verify that Select a table or range is checked and your database range is in the Table/Range box. (If the range of your entire database including column headings is not in the Table/Range box, you will need to click the collapse button and select the range of your database. 6. Select New Worksheet as the location of your PivotTable. 7. Click OK. We will layout the PivotTable on the next page. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 4 of 39

You should see a screen similar to the own shown to the left. You will now need to drag the fields into the boxes below them to construct your PivotTable. Note that if the PivotTable Field List is not visible, do one of the following: Click the pivot table chart area to the left. That should redisplay the list. If not, then click the Field List button on the Options tab. 8. Drag Rating into the Column Labels box. 9. Drag Category into the Row Labels box. 10. Drag Profit into the Values box. These areas are described below. Report Filter Placing a field in this box allows you to filter the entire pivot table by that field. For example, if you drag Production Company into the field then you can filter the entire table to only display movies by a particular production company. Column / Row Labels When you drag a text field into one of these boxes, each item in the field is listed just once as either a column or row heading. If you drag a number or date field, you can create column/row headings based upon ranges. Values When you drag a field here, the data fills out the middle section of the pivot table. You can sum, average, count, etc. number fields but can only count text fields dragged into this area. Removing a Field: If you need to remove a field from one of the boxes, simply drag it out of the box. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 5 of 39

FILTERING You can filter by your Row Labels and Column Labels. Further, you can also add a Report Filter field which is not involved in the PivotTable s structure but can be used for filtering. Once the filter is selected, the PivotTable will automatically update its structure and formulas to match the filter. 1. If you would like to use a third Report Filter, filter, drag a field which is not already part of the PivotTable into the Report Filter box. (In this example, we used Production Company.) 2. See the illustration below for using the filters. Report Filter - Placing a field in the Report Filter box gives you this drop down arrow and the options shown to the left. Check Select Multiple Items to display the results for more than one Production Company. Row & Column Filters - The options for these types of filters are shown below. Custom Filters The Label and Value Filters allow you to perform more advanced filtering by using the menus shown below. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 6 of 39

Clearing a Specific Filter Any field that a filter is applied to will have a small filter on the filter drop down arrow. To clear the filter, follow the steps below. 1. Click the filter s drop down arrow. 2. Check All or Select All. 3. Click OK. Clearing All Filters To clear all filters from the PivotTables at once, follow the steps below. 1. Click anywhere within the PivotTable. 2. Click the Options tab. 3. Click the Clear button. 4. Click Clear Filters. Clear all Fields, Formatting, & Filters from a Pivot Table If you would like to clear all fields and settings from your PivotTable, follow the steps below. 1. Click anywhere within the PivotTable. 2. Click the Options tab. 3. Click the Clear button and then Clear All. EXTRACT HIDDEN RECORD DETAILS TO A NEW SHEET (DRILL DOWN) This technique can be used to quickly extract the hidden details which created a number and place the details on a new sheet. For example, in the spreadsheet below the total profit for G rated Comedies is $412,655,160 and you would like to know what movies this includes. To find out, follow the steps below. 1. Right click on the value whose details you would like to extract. I want to know what movies the G rated comedies are so I will right click in the intersection of that column and row (Cell G6). 2. Click Show Details. Excel should create a new sheet which contains the data that went into creating the value you clicked in this example, all G rated comedies. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 7 of 39

SORTING To rearrange the order of your columns or rows, you can manually drag the row / column headings into the order you desire or sort them automatically into ascending (A-Z) or descending (Z-A) order. Sort by Row or Column Label in Ascending or Descending Order This section covers how to sort by Row and/or Column Labels in ascending (A-Z) or descending (Z-A) order. 1. Click the Row or Column Label drop down you wish to sort by. (You can sort by both a column and row.) 2. Select either Sort A-Z or Sort Z to A. Manually Arrange To manually place the columns or rows in any desired order, follow the steps below. 1. Click the Row or Column Label you wish to move ( Science Fiction or PG for example. 2. Place you mouse near the edge of the selected cell until the move icon appears. 3. Drag the cell up/down or left/right depending on whether you are moving a row or column label. Excel moves the other cells in the same row or column. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 8 of 39

Sort by Grand Totals (Column or Row) If you would like to sort by the Grand Total column or row (or both) follow these steps: 1. Click the Row or Column Label drop down you wish to sort by. 2. Click More Sort Options. 3. Set either the Ascending or Descending drop down to Sum of Profit (or whatever field you summarized). 4. Click OK. The image shows both Grand Totals sorted in ascending order. Note that if you are sorting by column, a simpler method is to use the sorting buttons under the Data tab. See the example below for more on this. Sort Values by a Specific Column Excel also allows you to sort by the values in a specific column. For example, you can sort the table by the values in the G column. If you are sorting by column, the simplest method is to use the sort buttons under the Data tab. 1. Click any value in the column you wish to sort by. For example, click in cell C6 if you wish to sort by the values G column. (Reference is from the image above.) 2. Click the Data tab and then either the A-Z or Z-A button. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 9 of 39

CHANGING THE MATHEMATICAL OPERATION (SUMMARIZE BY) When you place a numeric field in the Values box, it defaults to Sum ; however, you can also display averages, maximums, minimums, counts, standard deviations, variances, and products as well. 1. Click anywhere in your PivotTable to display the field list. 2. Click the Sum of profit drop down located under Values. 3. Click Value Field Settings. 4. On the Summarize by tab, select the desired mathematical operation (Average for example). 5. Click OK. The numbers in the value section should now be returning averages rather than sums. Note that you can also format the values by clicking the Number Format button. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 10 of 39

If you drag either a date or value field into one of the Labels boxes (rows or columns), Excel will let you specify the grouping intervals. For example, we have drug Year into the Row Labels box which created the display shown to the right. We would like to group all movies in the same year together and get totals by year. GROUP INTERVALS - DATES 1. Create the PivotTable structure shown to the left. 2. Click on one of the dates within the PivotTable. (A6 for example.) 3. Click the Options tab. 4. Click Group Field. (Group Selection or right clicking works too.) 5. If desired, specify a Starting and Ending date. This is typically done when you wish to limit the grouping to a more specific date range than dictated by the actual data in the database. For example, your database contains dates for the last 50 years but you would only like to include data in the last 10 years. 6. Specify the interval you would like to group by. In this example, we would highlight only Years. 7. Click OK. You should have the grouping shown below. Ungroup To ungroup, you can use Ungroup under Options or the right click menu. 1. Click on any cell in the column you grouped. 2. Right click and select Ungroup. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 11 of 39

GROUP INTERVALS NUMBER FIELDS In this example, we have placed a number field ( Profit ) in the Row Labels box which created the table shown below. What we would like to do is count the number of movies which made between 0 and 100 million, 100 million and 200 million, etc. 1. Create the PivotTable shown below. 2. Right click one of the cells in the profit column (A6 for example). 3. Select Group. 4. Set the Starting at interval to 0. 5. Set the Ending at interval to 500 million (500,000,000). 6. Set the interval (by) to 100 million (100,000,000). 7. Click OK. (If you want more interval groups, select a lower by number. For example, 10 million.) The PivotTable tells us the number of moves for each interval. The actual data and your intervals will determine the number of intervals the PivotTable displays. For example, the interval between 300 and 500 million is hidden because there are no movies in that range. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 12 of 39

CREATE SUBGROUPS BY COMBINING LABELS If you drag more than one field into the same labels box, Excel will create subgroups for you. In this example, we drug both Rating and Category into the Row Labels box resulting in the subgroup shown to the right. Because Rating is on top of Category in the PivotTable Field List, Rating is the main group and the Category is the sub group. Note also that you are not required to have both column and row labels. The Column Labels box is empty. Click the minus (-) buttons to hide a subgroup s details. Click its plus (+) to redisplay them. Place a Space between Groups / Hide Subtotals If you would like to place a space between your groups, move or hide the subtotals, or change the overall format, see the options below. Space Between Groups To place a space between the different groups, follow these steps: 1. Click anywhere within the PivotTable. 2. Click the Design tab. 3. Click the Blank Rows drop down. 4. Select Insert Blank Line after Each Item. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 13 of 39

Move or Hide/Display Subtotals To change the location of your subtotals or hide them completely, follow the steps below 1. Click anywhere within the PivotTable. 2. Click the Design tab. 3. Click the Subtotals drop down. 4. Select the desired option. Hide/Display Grand Totals To hide or display any of the Grand Total columns or rows, follow these steps: 1. Click anywhere within the PivotTable. 2. Click the Design tab. 3. Click the Subtotals drop down. 4. Select the desired option. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 14 of 39

CREATE MULTIPLE SUMMARY CALCULATIONS IN COLUMNS Excel also allows you to place more than one field in the Values area. Unlike the Labels boxes, you can drag the same field into the Values box multiple times. You can also drag different fields into the Values box. Excel creates this entry for you after you drag your second field into the Values box. In this example, we drug the Profit field into the Values box three times and then changed then their Value Field Settings to Count, Average, and Sum. Rename a Summary Field You can rename summary column heading by changing the name in the Custom Name box. To change a field s summary operation, simply select the summary type you would like to use. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 15 of 39

This example is very similar to the previous one except we are placing our multiple summary calculations in rows rather than columns. Each Production Co is listed in the left column and each rating becomes a column heading. We then have placed under each production company their total profit and the number of movies they have made. CREATE MULTIPLE SUMMARY CALCULATIONS BY ROW 1. Create the structure shown to the left. a. Drag Rating into Column Labels. b. Drag Production Co into Row Labels. c. Drag Profit into Values twice. 2. Drag the Values field Excel created for you in the Column Labels box into Row Labels box. 3. Click the second Sum of Profit drop down and change the Summarize by calculation to Count then click OK. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 16 of 39

PIVOT TABLES ADVANCED MATHEMATICAL OPERATIONS We previously examined how to change the summary option from Sum to Count, Average, Max, etc., but there are other options. Excel also allows you to calculate percents, running totals, and differences. In this section we will show examples of the different options available. These options are all available by accessing the screens below: 1. After placing a value or date field in the Values box, click its drop down arrow and select Value Field Settings. 2. Click the Show values as tab. 3. Click the drop down to access the options we will be showing in the examples to follow. See the next few pages for examples of using the different Show Value As options. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 17 of 39

Example: Difference From Use Difference From when you wish to see how much values have changed from a specific base or the pervious or next item on the list. In this example, we wish to see each year s total profit and how much that profit has changed since the previous year. 1. Structure the PivotTable as shown below by dragging Year into Row Labels and Profit into Values twice. 2. Change the grouping on Year to Years. (See page 11 for instructions on how to group.) 3. Create the Change from Previous Year column by making the Value Field Settings shown below. a. Summarize by is set to Sum. b. In Custom Name type: Change from Previous Year. c. Set Show values as to Difference From. d. Set Base Field to Year. e. Set Base Item to (previous) f. Click OK. 4. Create the Yearly Profit column by making the Value Field settings shown below. a. Summarize by is set to Sum. b. In Custom Name type: Yearly Profit. c. Leave Show values as set to Normal. d. Click OK. Note that Difference From uses this calculation: Item A Item B or in this example: Current Previous. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 18 of 39

Example: Percent Difference From Use Percent Difference From when you wish to see how much values have changed from a specific base or the pervious or next item on the list as a percent. This is similar to the last example so to shake things up a bit, we will count how many movies were made each year and find the percent difference from a specific year (1972) rather than the previous year. 1. Structure the PivotTable as shown below by dragging Year into Row Labels and Movies into Values twice. (Because we are counting, any field would work in the Values box.) 2. Change the grouping on Year to Years. (See page 11 for instructions on how to group.) 3. Create the % Diff. from 1972 column by making the Value Field Settings shown below. a. Summarize by is set to Count. b. In Custom Name type: % Diff. from 1972. c. Set Show values as to % Difference From. d. Set Base Field to Year. e. Set Base Item to 1972 f. Click OK. 4. Create the Count of Movies by Year column by making the Value Field settings shown below. a. Summarize by is set to Count. b. In Custom Name type: Movies by Year. c. Leave Show values as set to Normal. d. Click OK. Note that Percent Difference From uses this calculation: (Item A Item B)/Item B or (This Years Profit 1972 profit) / 1972 Profit Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 19 of 39

Example: Percent Of Unlike Percent Difference from which calculates the change as a percent change: (Item A Item B)/Item B Percent Of calculates what percent one item is of another: (Item A/Item B). Percent Of is useful when one item is part of another or otherwise related. For example, both Disney and Touchstone studios are both owned by the Walt Disney Company. We wish to see what percent Touchstone s profits are of Disney s. 1. Structure the PivotTable as shown below by dragging Production Co into Row Labels and Profit into Values twice. 3. Create the Percent of Disney column by making the Value Field Settings shown below. a. Summarize by is set to Sum. b. In Custom Name type: Percent of Disney. c. Set Show values as to % Of. d. Set Base Field to Production Co. e. Set Base Item to Disney f. Click OK. 4. Create the Studio Total Profit column by making the Value Field settings shown below. a. Summarize by is set to Sum. b. In Custom Name type: Total Profit. c. Leave Show values as set to Normal. d. Click OK. 5. To display only Disney and Touchstone, click the Row Labels (Studio) filter and check only Disney and Touchstone. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 20 of 39

Example: Running Total Running Total adds the previous line to the next for the column or row. It is useful when you wish to see how profits have grown over a specific period of time. In this example, for we would like to see how the Profit has increased over the four quarters for both Disney and Touchstone in the year 1978. 1. Structure the PivotTable as shown below by dragging Production Co the Report Filter box, Year into the Row Labels box, and Profit into Values twice. 2. Change the grouping on Year to Quarters. (See page 11 for instructions on how to group.) 3. Create the Quarter Total column by making the Value Field settings shown below. a. Summarize by is set to Sum. b. In Custom Name type: Quarter Total. c. Leave Show values as set to Normal. d. Click OK. 4. Create the Running Total column by making the Value Field Settings shown below. a. Summarize by is set to Sum. b. In Custom Name type: Running Total. c. Set Show values as to Running Total. d. Set Base Field to Year. e. Click OK. 5. To show only Disney and Touchstone movies, click the Production Co filter button. 6. Check Select Multiple Items. 7. Leave only Disney & Touchstone checked. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 21 of 39

Example: % of Row Percent of Row is useful when you wish to view each item which goes into a row total as a percent. In this example, we wish to see movie ratings as column labels and what percent each rating s profit was in the grand total for each month. 1. Structure the PivotTable as shown below by dragging Rating into the Column Labels box, Year into the Row Labels box, and Profit into the Values box. 2. Change the grouping on Year to Months. (See page 11 for instructions on how to group.) 3. Create the percentages by making the Value Field Settings shown below. a. Summarize by is set to Sum. b. In Custom Name type: Profits. c. Set Show values as to % of Row. d. Click OK. Filter by Date Note that in the PivotTable above, the data is for all years. If you would like filter it to be only for a specific year, use the Date Filter located beneath the Month drop down. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 22 of 39

Example: % of Column Percent of Column is similar to the previous example and is typically used to show how items in a column make up the total of that column by percent. In this example, we wish to see what percent each month s profit is of the total profit for the year. We are also breaking this down by rating. 1. Structure the PivotTable as shown below by dragging Rating into the Column Labels box, Year into the Row Labels box, and Profit into the Values box. 2. Change the grouping on Year to Months. (See page 11 for instructions on how to group.) 3. Create the percentages by making the Value Field Settings shown below. a. Summarize by is set to Sum. b. Set Show values as to % of Column. c. Set Custom Name to Percent of Month. d. Click OK. Filter by Date Note that in the PivotTable above, the data is for all years. If you would like filter it to be only for a specific year, use the Date Filter located beneath the Month drop down. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 23 of 39

Example: Percent of Total Percent of Total allows you to show each item in a column as a percent of its grand total. In this example, we will list each Category, its total profit, and then its percent of the columns grand total. 1. Structure the PivotTable as shown below by dragging Category into Row Labels and Profit into Values twice. 2. Percent Column - Create the Percent column by making the Value Field Settings shown below. a. Summarize by is set to Sum. b. In Custom Name type: Percent. c. Set Show values as to % of Total. d. Click OK. 3. Total Profit Column - Create the Total Profit by Category column by making the Value Field settings shown below. a. Summarize by is set to Sum. b. In Custom Name type: By Category. c. Leave Show values as set to Normal. d. Click OK. Note that you can also change the names used in the column headings by simply clicking in the cell and typing. We used this method to change Value to Total Profit. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 24 of 39

Example: Indexing Index calculates the weighted average in a cell using the following formula: ((value in cell) x (Grand Total)) / ((Grand Row Total) x (Grand Column Total)) It is intended to allow you to more easily compare values. 1. Structure the PivotTable as shown below by dragging Production Co into Row Labels, Rating into Column Labels, and Profit into Values. 2. Create the Indexing by making the Value Field Settings shown below. a. Summarize by is set to Sum. b. In Custom Name type: Indexing. c. Set Show values as to Index. d. Click OK. If you would like to hide the Grand Totals row, do the following: 1. Click anywhere within the PivotTable. 2. Click the Design tab. 3. Click the Grand Totals button. 4. Click On for Columns Only. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 25 of 39

REFRESHING YOUR PIVOTTABLE WHEN THE DATABASE CHANGES Should you edit a field in your database or add a new row, you will need to update your PivotTable. Update PivotTables When the Database is Edited Should you change any of the data within your database, any PivotTables will not automatically update. To update your PivotTables, follow the steps below. 1. Click anywhere within one of your PivotTables. 2. Click the Options tab. 3. Click the Refresh button. If you clicked the down arrow, click Refresh again. This should have refreshed all PivotTables in the workbook. Update PivotTables When the Rows are Added to a Database Should you add any new rows to your PivotTable, you will need to extend the range of your data source to include the new rows. 1. Click anywhere within one of your PivotTables. 2. Click the Options tab. 3. Click the Change Data Source button. (If you clicked the drop down, select Change Data Source again.) 4. Either manually edit the data range or click the collapse button to include the new rows. 5. When complete, click OK. Note that unlike Refresh, this will only update the current PivotTable. You will also need to perform these steps update any other PivotTables you have based on the same database. Update PivotTables When the Rows are Added to a Table If you have converted your database into a Table ( Insert table ), then when you add new rows to the bottom of the table, clicking the PivotTable s Refresh button should update the PivotTable with the new data. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 26 of 39

PIVOTTABLE FORMULA FIELDS (CALCULATED FIELDS & ITEMS) With a few restrictions, PivotTables allow you to create calculated formulas within the pivot tables. Within the calculated formula, you can include PivotTable fields, row or column items, numeric values, and use Excel functions. You cannot however use references to cell addresses or range names. Calculated formulas are useful when you need a calculation involving a field or fields but do not wish to restructure your database. There are two types of calculated formulas: Fields and Items Fields - Use a calculated field when you want to apply the formula to all data contained within the field in your formula. For example, =Profit / 2 ( Profit is the name of the field.) Items - Use a calculated item when you want your formula only to specific data within a field. For example, = G + PG (G & PG are both data items within the Rating field.) You cannot use calculated items on grouped fields. Example 1: Calculated Field Our database lists the profit for each movie in US Dollars, we would like an additional column which also lists each movie s profit in Euros which at the time this was written, requires multiplying Profit by.761657. 1. Structure the PivotTable as shown below by dragging Production Co into Row Labels and Profit into Values. 2. Click anywhere within the PivotTable. 3. Click the Options tab. 4. Click the Formulas drop down. 5. Click Calculated Field. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 27 of 39

6. At Name, type: Euros 7. At Formula, type the following: =Profit*.761657 8. Click Add then OK. Note the following: To place a field in the Formula box, you can also double click it or select it and then click the Insert Field button. Field names with spaces must be within single quotes (i.e. Net Pay ) 9. Excel has probably placed your calculated field in the Values area for you; if not, you will need to drag it there yourself. 10. Verify that the Value Field Settings for both Profit and Euros have been set to Sum. If not, click their down arrows and change their Value Field Settings to Sum yourself. Titles If you would like to change the column headings, simply click in the cells and type a new name. Formatting If you would like to display the Euro symbol, simply highlight the values and then right click and choose Number Format. You can then change the symbol to Euros. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 28 of 39

Example 2: Beware of Subtotals and Grand Totals with Calculated Fields In this example, we have created the PivotTable shown below from the database shown to the right. We also created a calculated field called Net Income which subtracts the tax amount from gross pay using the following equation: = Gross Income Gross Income * Tax Rate As you can see from the image below, this works fine for the individual employees but the department totals and grand total for Tax Rate and Net Income are incorrect. These values are incorrect because of the method PivotTables use to generate their sub and grand totals. Rather than adding up the items in each column vertically to arrive at the answer; Excel continues to follow our calculation and works horizontally. For example, in getting the Accounting Total, it sums each person s rate (.84) and multiplies that by the sum of their Gross Incomes (275000) rather than first multiplying each line individually and then adding those totals. There are two solutions to this: Hide Subtotals/Grand Totals - the Grand Totals and Subtotals can be turned off by using the Subtotals and Grand Totals buttons under the Options tab. Create the Calculation in the Database the second solution is to create the calculations back in the original database rather than in the PivotTable. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 29 of 39

Here is the same PivotTable with the sub and grand totals removed. This image shows the PivotTable s design structure. This image shows the Net Income calculation. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 30 of 39

Example 3: Calculated Item As stated earlier, calculated Fields involve calculations using the names of fields in the formula while calculated Items involve using the data of the field in the formula. In the example below, we have created a PivotTable which shows total profit by movie category. We would like to create the two new categories of Mild and Intense by combining the current categories as follows: Mild: Intense: Family + Comedy + Adventure Drama + 'Science Fiction' + Suspense 1. Create the PivotTable shown above by dragging Category into Row Labels and Profit into Values as shown to the right. 2. Rename Sum of Profit to Total Profit. For Calculated Item to be available, in your PivotTable you must first click in the column or row which is involved in the calculation. 3. Click in cell A5 or any other cells containing the name of a category. 4. Click the Options tab. 5. Click the Formulas button. 6. Click the Calculated Item drop down. Note that with this particular example, I sometimes received error messages at this point about grouping but when I copied the entire database to a new file, it worked. It could have something to do with multiple PivotTables from the same database or memory problems. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 31 of 39

7. At Name type: Mild 8. Type or insert the following formula: =Comedy + Adventure + Family 9. Click Add then OK. 10. Click the Options tab again. 11. Click the Formulas button again. 12. Click the Calculated Item drop down again 13. At Name type: Intense 14. Type or insert the following formula: =Drama + 'Science Fiction' + Suspense Note the around Science Fiction. This is because it contains a space. 15. Click Add then OK. At this point your PivotTable should look like the one shown to the left. You must now hide all categories but Mild and Intense. 16. Click the Type drop down arrow and uncheck all but Mild and Intense. 17. Click OK. Your PivotTable should now resemble the one shown to the left. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 32 of 39

Editing a Calculated Field or Item To edit a calculated field or item you have created, follow the steps below. 1. If it is a calculated field, click anywhere within the PivotTable. If it is a calculated item, click on one of the items in the PivotTable. 2. Click the Options tab. 3. Click the Formulas button. 4. Click either Calculated Item or Calculated Formula depending upon the type of formula you created. 5. Click the Name drop down. 6. Select the formula you wish to edit. 7. After making your edits, click Modify and then OK. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 33 of 39

USING THE SAME FIELD IN BOTH COLUMN AND ROW LABELS In this example, we wanted to use our Year column twice once as Row Labels grouped as quarters and once as Column Labels grouped as years. Unfortunately, PivotTables will not allow you to use the same field as both a Row and Column label. Our solution is to repeat the Year column again in our database as shown below. Once the Year column was copied; we placed the original in the Row Labels box and the copy in the Column Labels box. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 34 of 39

PIVOTTABLE DESIGN OPTIONS You can use the options under the Design tab to format your PivotTable with color, alter its display layout, and hide/display totals. 1. Click the PivotTable to access the Design tab. Grand/Sub Totals Use these options to hide/display grand and subtotals. Report Layout Use this to make cosmetic changes to the layout. Blank Rows Use this to insert/remov e blank rows between subtotals. PivotTable Style Options Check or uncheck these options to apply or remove background color to specific sections of your PivotTable. PivotTable Styles - Select from one of these Styles to apply colors to your PivotTable. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 35 of 39

PIVOTTABLE CHARTS In this section we will touch briefly on using PivotCharts. A PivotChart is simply a pie, bar, line, area, etc., chart based on your PivotTable. The PivotChart you create is dependent upon three things: PivotTable Structure The fields you select and their location in your PivotTable will determine the types of charts you can create. For example, if you want a pie chart then you need a very simple PivotTable with either a single column or single row heading and data. If you are creating a bar chart, then your PivotTable you will need both column and row headings along with your data. One will become a legend and one will be used along the X-Axis. The data will determine the height of the bars. Chart Type When you create a PivotChart, you must specify the type of chart you wish to create. Again, certain types of charts require certain PivotTable layouts. Chart Options This includes colors, label placement, etc., and is not covered in this handout. This handout is primarily concerned with the first two items, namely, structuring your PivotTable to give you the type of chart you are after. See the Excel 2007 Charts handout for information on chart options. They can be applied to any chart whether its data came from a PivotTable or a spreadsheet. Creating a PivotChart There are two ways to proceed when creating a PivotChart, except for the initial starting point, the process and end result are the same for both. PivotTable then PivotChart Using this method, you create a PivotTable first as we have been doing throughout this handout and once complete; you click the PivotChart button located under Options. If you change the PivotTable, the PivotChart will update. One obvious advantage to this method is when you have already created a PivotTable. PivotTable and PivotChart Simultaneously Using this method, as you layout the PivotTable, the PivotChart is being created at the same time. To use this option, simply select PivotChart rather than PivotTable from the PivotTable drop down. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 36 of 39

PivotChart Example 1: Pie Charts In this example, we will create a Pie Chart from a PivotTable based on the Movies database. 1. Create the PivotTable shown below by dragging Rating into Row Labels and Profit into Values. For pie charts, you will always use Row Labels and Values only. The field in Row labels will become the names of the pie slices and the field in Values determines the slice size. 1. Click anywhere within the PivotTable. 2. Click the Options tab. 3. Click the PivotChart button. Slice Names Slice Size 4. Select Pie as the type. 5. Select either the flat or 3D pie as the subtype. 6. Click OK. You should how have a pie chart and the PivotChart Filter Pane shown below. Both of these filters allow you to do the exact same thing hide ratings you don t wish to display. Formatting the Chart For instructions on displaying percents or values on the slices, changing the slice color, moving the labels, etc., see the Excel 2007 Charts guide. To poke around on your own, try some of the Chart Layout options located under the Design tab (click the chart first) or the options under Layout tab. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 37 of 39

PivotChart Example 2 Bar, Line, Area, & Column Charts We have included Bar, Line, Area, and Column charts in the same example because they all require the same PivotTable structure and use the same options. Their only difference is their chart type. This also means that the chart type is interchangeable. You can create a Line chart and then if you change your mind, change its type to a Column chart without having to alter the PivotTable structure or most of the chart options. Column Labels (Legend Fields) The field you place here becomes the legend. Values This is always a number field and determines the height of the bars or slope of the lines. Row Labels (Axis Fields) The field you place here becomes the X- Axis. This is typically a timeline but does not have to be. 1. Create the PivotTable shown to the left using the database on the Movies sheet. (It is the PivotTable the charts above are based upon. Its layout structure is also shown above.) Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 38 of 39

1. Click anywhere within the PivotTable. 2. Click the Options tab. 3. Click the PivotChart button. 4. Select Column as the type. (Line, Bar, and Area are also possible with our PivotTable.) 5. Select Clustered Column as the subtype. 6. Click OK. You should now have a Column chart similar to the upper column chart shown on the previous page. Changing Chart Type (Line, Bar, Column, & Area) As previously stated, Column, Line, Bar, and Area charts are interchangeable. If you would like to display the Column chart we have created in this example as a Line, Bar, or Area chart, follow these steps: 1. Click within the Chart 2. Click the Design tab. 3. Click the Change Chart Type button. 4. Select either Line, Bar, or Area and click OK. Moving the Chart To move the chart, use one of the methods below. Move on the Same Sheet To move the chart within the same sheet, simply click and drag it by its edge. Move to a Different Sheet To move the chart to a different sheet, follow these steps: 1. Click the chart to select it. 2. Click the Design tab. 3. Click the Move Chart button. 4. Select one of the options below. Click New Sheet and type a name if you would like to create a new sheet for the chart. Click Object In and select a sheet if you would like to move the chart to an existing sheet. 5. Click OK. Marshall School of Business - USC PivotTables.docx Wayne Wilmeth 1/26/09 Page 39 of 39