79
V O L U M E 3 DASH DESIGNS PC Training and Consulting Services Microsoft Excel Microsoft Excel Pivot Tables Pivot Tables For For

Pivot Tables

Embed Size (px)

Citation preview

Page 1: Pivot Tables

V O

L U

M E

3

DASH DESIGNS PC Training and Consulting Services

Microsoft Excel Microsoft Excel Pivot Tables Pivot Tables

For For

Page 2: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School, UC Berkeley — Dash Designs Training

Page 3: Pivot Tables

Microsoft Excel Pivot Tables For

The Haas School of Business, University of California

Copyrights and Trademarks

© 2006, Dash Designs, Jerry Maletsky San Rafael, CA 94903

email: [email protected] • fax (415) 491-1490

Any mention or use of Microsoft®, University of California, or any third party products is hereby acknowledged by Dash Designs to be for the sole purpose of editorial and educational use of this training manual and for the benefit of the mentioned parties.

Microsoft Excel Pivot Table Topics For The Haas School, UC Berkeley — Dash Designs Training

Dash Designs gives permission to the Haas School of Business of the University of California at Berkeley to reprint this training manual for internal use only. No re-sale of this material or renunciation of copyrights are granted by this author.

Revised: January 29, 2006

Page 4: Pivot Tables

Microsoft Excel Intermediate Topics For The Haas School, UC Berkeley — Dash Designs Training

Table of Contents Chapter 1: Working With Data ........ 2

♦ Overview of Excel Lists ...................... 2-3

♦ Sorting Data .................................... 4-7

♦ Filtering Data ..................................8-13

♦ Grouping Data............................... 14-17

♦ SubTotaling Data ........................... 18-19

Chapter 2:Creating Pivot Tables .... 20

♦ Creating Pivot Tables ..................... 20-28

♦ Re-Arranging Pivot Fields.....................29

♦ Updating Pivot Table Data............... 30-31

♦ Changing Data Field Functionality .... 32-33

♦ Changing Relationship Of Data ....... 34-37

♦ Filtering Pivot Table Data ................ 38-41

♦ Sorting Pivot Table Data ................. 42-43

♦ Grouping Pivot Table Data .............. 44-47

♦ Drilling Down Into Data .................. 48-53

♦ Charting Pivot Table Data ............... 54-55

♦ Auto Formatting Pivot Tables........... 56-60

Chapter 3: More Pivot Info ...... 61-75

Reference Workbook: Data Analysis.xls Sorting_Filtering Worksheet Sub-Totals Worksheet Auto Outline Worksheet Group Manually Worksheet

Reference Workbook: Data Analysis.xls Source Data Worksheet

Page 5: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

1

1

Microsoft Excel Pivot Table

Training For

Jerry Maletsky

Dash Designs

Training And Consulting

Page 6: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

2

1 Overview of Excel Lists

Working With Data

Reference Workbook: Data Analysis.xls Sorting_Filtering Worksheet

An Excel list (also known as a database or flat-file) is organized into columns and rows just like a spreadsheet. A Spreadsheet consists of labels on the top row(s) and labels in the first column with numerical values in the intersection of each label. A list in Excel consists of a contiguous range of cells (no blank rows or columns) in which only the top row of the data contain the labels describing the information in the column below (fields). Every other row is considered a record of information describing that item.

In Excel (and similar spreadsheet programs), they are called flat-files. Relational databases (i.e. Microsoft Access) allow the data to be organized into separate smaller lists (tables) and then, when required, allow the user to combine that data into one report. Flat-file programs require all the data to be in one contiguous range of cells on the same worksheet for the user to be able to work with that data together.

Example of a Spreadsheet

Labels

Page 7: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

3

1 Working With Data

Working With Flat-Files

Example of a Flat-File List

Labels (Only in the first row)

It is very important that when adding new records that they be added in the next available row (i.e., A23) or in an inserted row somewhere between the first and last record. Otherwise, new data will not be considered part of the list.

Great Tip!

Header Row/Field Names

Record

Field

Page 8: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

4

1 Sorting Data Sorting data is the process of rearranging data in a list or spreadsheet in particular order. A list is considered a contiguous range of cells in which the top row are the column headings (field names) and every other row in the range is considered a record. The list is separated from other data in the worksheet by at least one blank row or column.

Data can be sorted one column at a time or up to three columns within one sort.

Data in a list can be sorted in ascending or descending order. In an ascending sort, Excel uses the following order. (In a descending sort, this sort order is reversed except for blank cells, which are always placed last.)

Numbers Numbers are sorted from the smallest negative number to the largest positive number.

Dates Dates are sorted from the earliest date to the latest date.

Alphanumeric When you sort alphanumeric text, Excel sorts left to right, character by character. For example, if a cell contains the text "A100," Excel places the cell after a cell that contains the entry "A1" and before a cell that contains the entry "A11."

Text and text with numbers are sorted in the following order:

0 1 2 3 4 5 6 7 8 9 (space) ! " # $ % & ( ) * , . / : ; ? @ [ \ ] ^ _ ` { | } ~ + < = > A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Apostrophes (') and hyphens (-) are ignored, with one exception: If two text strings are the same except for a hyphen, the text with the hyphen is sorted last.

Logical values In logical values, FALSE is placed before TRUE.

Error values All error values are equal.

Blanks Blanks are always placed last.

Reference Workbook: Data Analysis.xls Sorting_Filtering Worksheet

Working With Data

Page 9: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

5

1 Sorting Data

Steps:

⇒ Click into a cell within the column the sort will be based

⇒ Click the Sort Ascending button or Descending

button

Sorting on one column

Sorting Ascending

Sorting Descending

Working With Data

Page 10: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

6

1 Sorting Data on Multiple Columns Excel allows any one sort to include up to 3 fields at a time. The sorting toolbar buttons cannot sort on more than 1 field at a time. However, the Data menu: Sort command can sort data up to 3 fields.

If more than 3 fields are necessary to sort, Sort the fields in groups of 3, using the least important fields first. Then sort the most important field last.

For example, suppose a list containing First Name, Last Name, Department, and Region information needed to be sorted so that all the departments were organized by name and then region. The user would sort by Last Name, First Name, and then Region using the Data menu: Sort command. Lastly the user would sort by Department using the Sort Ascending or Sort Descending toolbar button.

Steps:

⇒ Click anywhere in the contiguous cell range of the list

⇒ Click Data menu: Sort command

⇒ In the Sort By box, select the primary field to sort and

whether ascending or descending

⇒ In the Then By box, select the second field to sort and

whether ascending or descending

⇒ In the next Then By box, select the third field to sort

and whether ascending or descending

⇒ Click OK

Working With Data

Page 11: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

7

1 Sorting Data on Multiple Columns

Working With Data

Page 12: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

8

1 Filtering Data Filtering data provides a way to display only the preferred data while hiding the remainder of that data list. For example, in a list of hundreds of product sales containing product names, regional locations, dates, dollar amounts, etc., a user can just display only the records for a particular product or region.

Autofilter is a process that allows the user to choose from a list of items in that column and hide all data except the chosen option. When activated, AutoFilter places drop-down lists at the head of each column. The user simply opens the list of the preferred data column and selects the item. In addition, a user can specify a range of values such as the Top 10 or Bottom 5% of records using the (Top 10…) option in AutoFilter. There is also a (Custom…) option in which a user can set a range of values (i.e. a field containing values from 0 to 100,000) between 5,000 and 10,000.

Steps:

TO ACTIVATE AUTOFILTER

⇒ Click in any cell within the list

⇒ Click Data menu: Filter: AutoFilter command

⇒ Click a list button in a column heading

⇒ Select the preferred item on which to filter

TO RETURN ALL RECORDS TO VIEW

⇒ Click that same list (blue) button and select (All)

TO TURN OFF AUTOFILTER

⇒ Click Data menu: Filter: AutoFilter command

Reference Workbook: Data Analysis.xls Sorting_Filtering Worksheet

Working With Data

Page 13: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

9

1 Filtering Data

Working With Data

Page 14: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

10

1 Filtering Data Using The Top 10 Option Using the AutoFilter’s Top 10 feature allows the user to display a range of records in which its values are at the top or bottom range of that field. For example, a user could filter for only the records that contain the top 15% of sales.

Steps:

⇒ Click in any cell within the list

⇒ Click Data menu: Filter: AutoFilter command

⇒ Click a list button in a column heading

⇒ Select the (Top 10…) option

⇒ In the dialog box, choose the following options:

in the left-side box, select Top or Bottom

In the center box, enter a value

In the right-side box, select Percent or Items

⇒ Click OK

TO RETURN ALL RECORDS TO VIEW

⇒ Click that same list (blue) button and select (All)

Working With Data

Page 15: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

11

1 Filtering Data

Records Filtered on top Total Sales field

Note: when percent is selected the number of records that will be displayed will be equal to that percentage of the total records.

Working With Data

Page 16: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

12

1 Filtering Data Using The Custom Criteria Using the AutoFilter’s Custom feature allows the user to display records in which its values fall into a range of values for that field. For example, a user could filter for only the records that contain the quantities sold between 25 and 50.

Steps:

⇒ Click in any cell within the list

⇒ Click Data menu: Filter: AutoFilter command

⇒ Click a list button in a column heading

⇒ Select the (Custom…) option

⇒ In the dialog box, choose the following options:

in the top left-side box, select a comparison operator

In the top right-side box, type or select a value in that field

In the bottom left-side box, select a comparison

operator (if required)

In the bottom left-side box, type or select a value in that

field

⇒ Click OK

TO RETURN ALL RECORDS TO VIEW

⇒ Click that same list (blue) button and select (All)

Working With Data

Page 17: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

13

1

Records Filtered on top Total Sales field

Records Filtered on custom criteria

Filtering Data Using The Custom Criteria

Working With Data

Page 18: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

14

1 Grouping Data Grouping data in a worksheet allows you to hide or display the detail but leave the calculated areas of your worksheet visible. This is particularly useful in a large itemized worksheet. For example, in a worksheet displaying monthly sales figures with quarterly subtotals, a user can hide the monthly detail and just display the quarterly subtotals along with the grand total.

Data can be grouped automatically or manually.

Steps:

⇒ Click anywhere in the worksheet

⇒ Click Data menu: Group and Outline: Auto Outline

Grouping Data Automatically

Steps:

⇒ Click anywhere in the worksheet

⇒ Click Data menu: Group and Outline: Clear Outline

Un-Grouping Data Automatically

Reference Workbook: Data Analysis.xls Auto Outline Worksheet

Working With Data

Page 19: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

15

1 Grouping Data

Worksheet with AutoOutline Activated

Worksheet with AutoOutline Collapsed

Working With Data

Page 20: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

16

Grouping Data

Steps:

⇒ Select the Row or Columns to group

⇒ Click Data menu: Group and Outline: Group

Grouping Data Manually

Steps:

⇒ Select the Row or Columns to group

⇒ Click Data menu: Group and Outline: UnGroup

Un-Grouping Data Manually

1 Reference Workbook: Data Analysis.xls Group Manually Worksheet

Working With Data

Page 21: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

17

Grouping Data

Worksheet with Columns Grouped

Worksheet with Column Group Collapsed

1 Working With Data

Page 22: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

18

1 Subtotaling Data Excel provides a method to subtotal your data in a list automatically without interrupting the “contiguous” flow of the records in the list. The Subtotal command groups your data based on the field you choose and calculates a subtotal based on the function you choose (i.e. Sum Average, Count, etc.) and the field you choose to calculate.

IMPORTANT: THE LIST MUST BE SORTED BY THE FIELD YOU WILL BE GROUPING ON PRIOR TO ACTIVATING THE SUBTOTAL COMMAND.

Steps:

⇒ Click into the list

⇒ Click Data menu: Subtotals

⇒ Set the field you want to group on in the

“At Each Change In” box

⇒ Set the function you want to

use to calculate in the

“Use Function” box

⇒ Check the field(s) you want

to calculate in the

“Add Subtotal to” box

⇒ Click OK

Subtotaling Data

Reference Workbook: Data Analysis.xls Subtotals Worksheet

Great Tip!

Note: To remove the Subtotals, click the Remove All button

Working With Data

Page 23: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

19

1 Subtotaling Data

Worksheet With Data: Subtotals Activated

Note: Excel provides Grouping buttons to hide or display levels of data

Working With Data

Page 24: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

20

2 Creating Pivot Tables

A Pivot Table report is an interactive table that quickly combines and compares large amounts of data. You can rotate its rows and columns to see different summaries of the source data and you can display the details for areas of interest.

Use a Pivot Table report when you want to analyze related totals, especially when you have a long list of figures to sum and you want to compare several facts about each figure. In the report illustrated above, you can easily see how the third-quarter golf sales in cell F3 stack up against sales for another sport or quarter, or the total sales. Because a Pivot Table report is interactive, you can change the view of the data to see more details or calculate different summaries, such as counts or averages.

Creating Pivot Tables

Reference Workbook: Data Analysis.xls Source Data Worksheet

Page 25: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

21

Creating Pivot Tables

There are Four (4) types of fields in a Pivot Table:

♦ Row

♦ Column

♦ Data

♦ Page

In a Pivot Table report, each column or field in your source data becomes a Pivot Table field that summarizes multiple rows of information. In the example on the previous page, the Sport column becomes the Sport field and each record for Golf is summarized in a single Golf item.

A Row field is designated as the labels for each row. A Column field is designated as the labels for each column. In choosing which field(s) will be designated as Row or Column remember that Excel is limited to 256 columns across the worksheet which may influence the decision.

A Data field, such as Sum of Sales, provides the values to be summarized. Cell F3 in the report above contains the sum of the Sales value from every row in the source data for which the Sport column contains Golf and the Quarter column contains Qtr3.

A Page field is designated if the user wants to filter the Pivot Table for a particular item in that Page field.

To create a Pivot Table report, you run the Pivot Table and Pivot Chart Wizard. In the wizard, you select the source data you want from your worksheet list or external database. The wizard then provides you with a worksheet area for the report and a list of the available fields. As you drag the fields from the list window to the outlined areas, Microsoft Excel summarizes and calculates the report for you automatically.

After you create a Pivot Table report, you can customize it to focus on the information you want: change the layout, change the format, or drill down to display more detailed data.

Creating Pivot Tables

2

Page 26: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

22

Creating Pivot Tables

Excel Data List

2 Creating Pivot Tables

Page 27: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

23

Creating Pivot Tables

Pivot Table Summarizing Data From Excel List

Creating Pivot Tables

2

Page 28: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

24

Steps:

⇒ Click anywhere in the contiguous area that makes up your list

⇒ Click Data menu: Pivot Table and Pivot Chart Report command

⇒ In Step 1 of the Pivot Table Wizard, select the source for the

Pivot Table

(An Excel list or Database) and click Next

⇒ In Step 2, confirm the list range and click Next

⇒ In Step 3, Select the location (New Worksheet or Existing

Worksheet) and click Finish

Create a Pivot Table (3-Step Wizard process)

Creating Pivot Tables

Pivot Table Wizard - Step 1

2 Creating Pivot Tables

Page 29: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

25

Pivot Table Wizard - Step 2

Pivot Table Wizard - Step 3

Creating Pivot Tables

Creating Pivot Tables

2

Note: Above data range of source data is based on records added within the contiguous range of records on that worksheet. Therefore, it is important to add future new records by inserting new rows within the contiguous range of the list (see previous information on Page 2).

Page 30: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

26

Creating Pivot Tables

Now you are ready to create the Pivot Table.

Just drag the fields from the Pivot Table Field List box into the area of the Pivot Table you want to populate.

Note: Drag the Data Field item last as that will make it harder to add the Row or Column field after that.

Empty Pivot Table Layout

Great Tip!

2 Creating Pivot Tables

Page 31: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

27

Creating Pivot Tables

Populated Pivot Table

Creating Pivot Tables

2

Page 32: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

28

Pivot Table Toolbar

Pivot Table Menu Button Format Report

Pivot Chart

Hide Detail

Show Detail

Refresh Data

Always Display Items

Field Settings

Show Field List

Include Hidden Items

2 Creating Pivot Tables

Page 33: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

29

Pivot Tables are extremely flexible. After placing the initial fields to be viewed in the Pivot Table, they can be resituated to another position in that Pivot Table or removed from the Pivot Table. Additional fields can also be added to a Row, Column, Data, or Page field area.

ReArranging Pivot Table Fields

Steps: Re-Arranging Pivot Table Fields

⇒ Point over the Pivot Table field heading

⇒ Drag field to another field area in that Pivot Table

(i.e. Row to Column area)

Removing Pivot Table Fields

⇒ Point over the Pivot Table field heading

⇒ Drag field back out of the Pivot Table area

Adding Additional Pivot Table Fields

⇒ Click on the Pivot Table toolbar Show Field List button

(if necessary)

⇒ Select field and drag into the preferred Pivot Table area

(i.e. Row to Column area)

Moving Pivot Table Fields - Before

Moving Pivot Table Fields - After

Creating Pivot Tables

2

Page 34: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

30

By default, Pivot Tables do not update as data changes in the underlying list. If you want to make sure the Pivot Table displays the latest data from the source flat-file list, manually update the Pivot Table.

Updating Pivot Tables

Steps:

⇒ Click into the Pivot Table

⇒ Click the Refresh button on the Pivot Table toolbar

Manually Update a Pivot Table

New data added to the bottom of the list will not be included in the Pivot Table. To avoid having to reset the original cell range the Pivot Table is based on, insert a row within the original cell range to add the new record(s). You can then sort the list to re-order the data.

Great Tip!

2 Creating Pivot Tables

Note: Pivot Table toolbar is only visible when the user has activated the Pivot Table by clicking into it. If the toolbar is still not visible after clicking into the table it can be opened using the View menu: Toolbars command.

Add New Records Within Original Data Source Range

Not In

cluded

In Pivo

t Tab

le

Page 35: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

31

Pivot Table Options Button

The Pivot Table Options dialog box allows the user to set controls on the Pivot Table. These include setting refresh options, turning off Grand Totals, Preserving formatting, and how to display empty cells and error values.

Creating Pivot Tables

2

Page 36: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

32

By default, Data Fields summarize their data using the Sum function. Excel allows Data Fields to be summarized with a group of other functions such as Average, Count, Min, Max, and StdDev.

The Field Settings dialog box contains the function options. In addition to the function, this dialog box allows the user to rename the field, format field values, and change the relationship of summarized data to the other data in that field.

Changing The Functionality of A Data Field

Steps:

⇒ Click a value in the data field

⇒ Click the Pivot Table button on the Pivot Table toolbar

⇒ Click Field Settings command

⇒ Select a different function, if necessary

⇒ Click into the Name box and rename data field, if necessary

⇒ Click on the Number button and format field, if necessary

⇒ Click OK

Field Settings Dialog Box

2 Creating Pivot Tables

Page 37: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

33

Changing The Functionality of A Data Field

Field Settings Menu Command

Changing The Functionality Of The Data Field

Creating Pivot Tables

2

Page 38: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

34

Changing The Relationship Of Summarized Data

As mentioned previously, the Field Settings dialog box contains the function options. In addition to the function, this dialog box allows the user to change the relationship of summarized data to the other data in that field. By default, the values in the Data Field display as they are. Specifically, a value of 100 displays as 100, independent of any other values.

By clicking the Options button in the Field Settings box and changing the Show Data As option, the data can be viewed as it relates to other values. For example, the value can be displayed as the Difference From a selected value in that Data Field. Other options include showing data as a percentage to the row field or the column field or total.

2 Creating Pivot Tables

Page 39: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

35

Changing The Relationship Of Summarized Data

Pivot Table With Data Field Displaying Percentage of Row Item

(See next 2 pages for breakdown of data field options)

Note: Zero Values are hidden in this example. The command to hide zero values is the Tools menu: Options command. On the View tab, uncheck Zero Values option.

Great Tip!

Creating Pivot Tables

2

Page 40: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

36

Changing The Relationship Of Summarized Data

Function Result

Difference From Displays all the data in the data area as the difference from the value for the specified Base field and Base item. The base field and base item provide the data used in the custom calculation.

% Of Displays all the data in the data area as a percentage of the value for the specified Base field and Base item. The base field and base item provide the data used in the custom calculation.

% Difference From

Displays all the data in the data area as the difference from the value for the specified Base field and Base item, but displays the difference as a percentage of the base data. The base field and base item provide the data used in the custom calculation.

Running Total In Displays the data for successive items as a running total. You must select the field for which you want to show the items in a running total.

2 Creating Pivot Tables

Page 41: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

37

Changing The Relationship Of Summarized Data

% of row In a Pivot Table report, displays the data in each row as a percentage of the total for each row. In a Pivot Chart report, displays the data as a percentage of the total for the category.

% of column In a Pivot Table report, displays all the data in each column as a percentage of the total for each column. In a Pivot Chart report, displays the data as a percentage of the total for the series.

% of total In a Pivot Table report, displays the data in the data area as a percentage of the grand total of all the data in the report. In a Pivot Chart report, displays the data as a percentage of the total of all data points.

Index Displays the data by using the following calculation: ((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total))

Function Result

Creating Pivot Tables

2

Page 42: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

38

The Pivot Table displays all items in the field that is placed in the table. The data in the Pivot Table can be filtered to display only the required items in that field. Data can be filtered by hiding items in a row or column field. In addition, data can be filtered by placing a field in the Page Field area and selecting an item in that field to display. All other items in that Page Field will be hidden.

Filtering Data In Pivot Tables

Filtering Data In A Row/Column Field

Steps: Filtering Data In A Row/Column Field

⇒ Click on the list button on the field name

⇒ Uncheck any field to be hidden

⇒ Click OK

Redisplaying Data In A Row/Column Field

⇒ Click on the list button on the field name

⇒ Check (Show All)

⇒ Click OK

Filtering Data In A Page Field

⇒ If necessary, drag a field from the field

list to the Page Field area

⇒ Click the list button on the field name

⇒ Select the item to be displayed

⇒ The Pivot Table will now display only

those records from that item

Redisplaying Data In A Page Field

⇒ Click the list button on the field name in the Page Field area

⇒ Check (All)

⇒ Click OK

2 Creating Pivot Tables

Page 43: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

39

Filtering Data In Pivot Tables

Filtered Data - Before

Filtered Data - After

Creating Pivot Tables

2

Page 44: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

40

Filtering Data In Pivot Tables With Page Fields

Page fields allow you to filter the entire Pivot Table report to display data for a single item or all the items. More than one field can be displayed as a page field.

Steps: To Add a Page Field

⇒ Drag the field from the field list to the Page Field Area of the

Pivot Table

To Filter a Pivot Table with a Page Field

⇒ Open the Filter button in the Page Field

⇒ Select an entry to act as criteria

2 Creating Pivot Tables

Page Field List

Page Field Page Field List Button

Page 45: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

41

Filtering Data In Pivot Tables With Page Fields

Page Field Filtered Data - Before

Page Field Filtered Data - After

Creating Pivot Tables

2

Page 46: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

42

Sorting Data In Pivot Tables Data in a Pivot Table displays in the order that data appears in the source flat-file list. However, data can be sorted automatically or manually at any time after the Pivot Table is created.

Steps:

To Automatically Sort Data In A Row/Column Field

⇒ Click on an item in the required row or column field

⇒ Click Sort Ascending or Sort Descending buttons

To Manually Sort Data In A Row/Column Field

⇒ Click on an item in the required row or column field

⇒ Drag to the required position

⇒ Repeat for each item as necessary

Sorting Data Before

2 Creating Pivot Tables

Page 47: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

43

Sorting Data In Pivot Tables

Sorting Data After

Creating Pivot Tables

2

Page 48: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

44

Grouping Data In Pivot Tables

Items in a Row or Column field can be grouped in order to view and analyze data in a higher level summary format. Groups of data can be collapsed to view the data as a set of data not available from the source flat-file list.

Steps: To Group Selected Items In A Row/Column Field

⇒ If necessary, sort the items in the field in the preferred order

⇒ Select the items needed to create the first group

⇒ Click the Pivot Table button on the Pivot Table toolbar

⇒ Click Group And Show Detail, Group command

⇒ Repeat the above 3 steps as needed

To UnGroup Selected Items In A Row/Column Field

⇒ Select the items needed to un-group

⇒ Click the Pivot Table button on the Pivot Table toolbar

⇒ Click Group And Show Detail,

UnGroup command

⇒ Repeat the above 3 steps as

needed

2 Creating Pivot Tables

Page 49: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

45

Grouping Data In Pivot Tables

Grouping Data Before

Grouping Data After

Creating Pivot Tables

2

Page 50: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

46

Renaming Groups In Pivot Tables

The names of the groups can be customized to reflect the data. In addition, the label for the group field can be customized.

Steps:

To Rename Groups In A Row/Column Field

⇒ Click on the name of the group (i.e. Group1)

⇒ Type a new name

To Rename The Group Field In A Row/Column Field

⇒ Click on the name of the group label (i.e. Line No2)

⇒ Type a new name

2 Creating Pivot Tables

Page 51: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

47

Naming Groups

Renaming Groups In Pivot Tables

Creating Pivot Tables

2

Page 52: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

48

Drilling Down On Data In Pivot Tables Groups of data can be collapsed to show just the totals for that group and then expanded to display the detail data again.

Steps:

To Drill Down In A Row/Column Field

⇒ Double-Click on the name of the group (i.e. Northern)

-- OR --

⇒ Click on the name of the group

⇒ Click the Hide Detail button on the Pivot Table toolbar

⇒ The group data will collapse to show summary data for group

To Expand Data In A Row/Column Field

⇒ Double-Click on the name of the group (i.e. 300 Series)

-- OR --

⇒ Click on the name of the group

⇒ Click the Show Detail button on the Pivot Table toolbar

⇒ The group data will expand to show detail for group

2 Creating Pivot Tables

Page 53: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

49

Drilling Down On Data In Pivot Tables

Creating Pivot Tables

2

Page 54: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

50

Breaking Down Data Fields

Pivot Tables summarize data in the Data Field. A value in the Data Field can represent hundreds of records in the underlying data list. You can view the detail of the summarized data in the Data Field by double-clicking a value. Excel will create a new worksheet with a list of the records that make up that summarized value.

Steps:

⇒ Click into the Pivot Table

⇒ Double-Click on a Data Field

(A new worksheet will appear with the detail records that

make up that data field value)

To Build Reports Based On Data Fields

Double-Click

Creates New Worksheet

2 Creating Pivot Tables

Page 55: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

51

Breaking Down Data Fields

Build Reports Based On Data Fields - Before

Build Reports Based On Data Fields - After

Creating Pivot Tables

2

Page 56: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

52

Note: Choose the preferred page field (there could be several) and click OK.

Building Pivot Tables Based From Page Fields

You can build new Pivot Table reports based on Page Fields. These new reports create new worksheets containing Pivot Tables displaying data from each of the items in that Page Field.

Steps:

⇒ Click into the Pivot Table

⇒ Click the Pivot Table toolbar button

⇒ Select Show Pages

⇒ Click OK

To Build Reports Based On Page Fields

2 Creating Pivot Tables

Page 57: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

53

Building Pivot Tables Based From Page Fields

New Pivot Table As A Result Of Show Pages Command

Creating Pivot Tables

2

Page 58: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

54

Charting Pivot Tables

Pivot Tables can be charted at the same time as they are created or any time after. The default chart type is a Stacked Column. This is a very efficient way to display the chart as many times the data in a Pivot Table is not consistent (there might not be any). There may be many values in the Data Field. Typical column or line charts do not display large amounts of data well.

The chart is linked to the Pivot Table. Pivot charts contain row, column, data, and page field areas just as in the table.

Any changes to fields in the Pivot Table effect the chart. As well, any changes to the fields in the chart effect the Pivot Table. Pivot Table charts can be formatted just as any chart created in Excel. That includes chart type, chart options, formatting series, legends, and data labels.

Steps:

⇒ Click into the Pivot Table

⇒ Click the Pivot Table button on the toolbar

⇒ Select Pivot Chart command

⇒ Edit the chart as necessary

To Chart Pivot Tables

2 Creating Pivot Tables

Page 59: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

55

Charting Pivot Tables

Creating Pivot Tables

2

Page 60: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

56

AutoFormat Pivot Tables

Pivot Tables can be formatted just like data in any worksheet. Font, number, shading, and border formatting can be added to areas of the Pivot Table. The Pivot Table Options dialog box contains an option to Preserve formatting that will retain user-added formatting when the table data is refreshed.

In addition, formatting can be added automatically using the Format Report command in the Pivot Table toolbar button. The formatting is organized by Report-types and Table-types of formatting. It is important to note that the Report-type formatting will change the orientation of the Pivot Table. They move the column fields into the row field area creating a vertical orientation. Table-type formatting will retain the vertical/horizontal orientation of the existing Pivot Table.

Steps:

⇒ Click into the Pivot Table

⇒ Click the Pivot Table button on the toolbar

⇒ Select Format Report

⇒ Choose a layout from the Report-types or the Table-types

⇒ Click OK

To AutoFormat Pivot Tables

2 Creating Pivot Tables

Page 61: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

57

AutoFormat Pivot Tables

AutoFormatting With Report-type Formats

Pivot Table Vertical Orientation With Report Format

Creating Pivot Tables

2

Page 62: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

58

AutoFormat Pivot Tables

AutoFormatting With Table-type Formats

Pivot Table Horizontal/Vertical Orientation With Table Format

2 Creating Pivot Tables

Page 63: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

59

Notes

Creating Pivot Tables

2

Page 64: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

60

Each time you create a new Pivot Table or Pivot Chart report, Microsoft Excel stores a copy of the data for the report in memory and saves this storage area as part of the workbook file. Thus each new report requires additional memory and disk space. However, when you use an existing Pivot Table report as the source for a new report in the same workbook, both reports share the same copy of the data. Because you reuse the same storage area, the size of the workbook file is reduced and less data is kept in memory.

Location requirements To use a Pivot Table report as the source for another report, both reports must be in the same workbook. If the source Pivot Table report is in a different workbook, copy the source report to the workbook where you want the new report to appear. Pivot Table and Pivot Chart reports in different workbooks are separate, each with their own copy of the data in memory and in the workbook files.

Page field settings The source Pivot Table report cannot contain any page fields that are set to query for external data as you select each item. Reports with this setting don't appear in step 2 of the wizard. To check the setting, double-click each page field, click Advanced, and make sure Retrieve external data for all page field items is selected.

Creating Multiple Pivot Tables From Same Source

3 Additional Pivot Table Information

Page 65: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

61

Changes affect both reports When you refresh the data in the new report, Excel also updates the data in the source report, and vice versa. When you group or ungroup items in one report, both are affected. When you create calculated fields or calculated items in one report, both reports are affected.

Pivot Chart reports You can base a new Pivot Table or Pivot Chart report on another Pivot Table report, but not directly on another Pivot Chart report. However, Excel creates an associated Pivot Table report from the same data whenever you create a Pivot Chart report, so you can base a new report on the associated report.

Changes to a Pivot Chart report affect the associated Pivot Table report, and vice versa. If you want to be able to change the layout or display different data without these changes affecting both reports, create a new Pivot Table report based on the same source data as the Pivot Chart report rather than basing it on the associated Pivot Table report.

Pivot Table lists from Web pages You can export a Pivot Table list from your Web browser to Excel and view and save the list as a Pivot Table report. The new Pivot Table report and the Pivot Table list both use the same source data but no link is maintained between the list and the report.

Creating Multiple Pivot Tables From Same Source

Additional Pivot Table Topics

3

Page 66: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

62

Source Data Terminology

Term Description

AutoFilter Process of hiding records in a list that do not match the selected item.

Flat-File A list of information in a contiguous range of cells. The top row is called the Header Row which contains the column headings. Each row below is considered a record.

Data Validation Properties assigned to cells which limit what data can be entered into those cells. They can be displayed as drop-down lists containing the possible entries.

Pivot Table An interactive cross-tabulated report that summarizes and analyzes records in Excel lists or external databases.

Pivot Table Fields

Row Fields

Column fields

Data field

Page Field

A Pivot Table consists of fields.

Labels that describe each row.

Labels that describe each column.

Values that are being summarized.

Fields that act as filters in a Pivot Table.

Spreadsheet Also called a worksheet. A spreadsheet consists of cells that are organized into columns and rows; a worksheet is always stored in a workbook.),

3 Additional Pivot Table Topics

Page 67: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

63

Source data

Source data for the illustrations in this topic.

The underlying rows or database records that provide the data for a Pivot Table report. You can create a Pivot Table report from a Microsoft Excel list, an external database, multiple Excel worksheets, or another Pivot Table report.

Field

Region, Sum of Sales, Quarter, and Sport are fields.

A category of data that's derived from a field in the source list or database. The Sport field, for example, might come from a column in the source list that's labeled Sport and contains the names of various sports (Golf, Tennis) for which the source list has sales figures.

Item

A subcategory, or member, of a field. Items represent the unique entries from the field in the source data. For example, the item Golf represents all rows of data in the source list for which the Sport field contains the entry Golf.

Pivot Table Terminology

Pivot T

able T

ermin

olo

gy co

nten

t was taken

from M

icroso

ft ® an

d ed

ited an

d re-fo

rmatted

.

Additional Pivot Table Topics

3

Page 68: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

64

Row field

The Sport field is a row field.

A Pivot Table report that has more than one row field has one inner row field (Sport, in the example below), the one closest to the data area. Any other row fields are outer row fields (Region, in the example below). Items in the outermost row field are displayed only once, but items in the rest of the row fields are repeated as needed.

Region is an outer row field; Sport is an inner row field.

Column field

The Quarter field is a column field

Field labels at the top of each column in a Pivot Table. Just as in a row field, there can be more than one column field.

Pivot Table Terminology

3 Additional Pivot Table Topics

Page 69: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

65

Page field

The Region field is a page field.

Page fields allow you to filter the entire Pivot Table report to display data for a single item or all the items.

Data field

The Sum of Sales field is a data

field.

Data fields provide the data values to be summarized. Usually data fields contain numbers, which are combined with the Sum summary function, but data fields can also contain text, in which case the Pivot Table report uses the Count summary function.

If a report has more than one data field, a single field button named Data appears in the report for access to all of the data fields.

Summary function

Data field is using the Sum function.

The type of calculation used to combine values in a data field. Pivot Table reports usually use Sum for data fields that contain numbers and Count for data fields that contain text. You can select additional summary functions such as Average, Min, Max, and Product.

Pivot Table Terminology

Pivot T

able T

ermin

olo

gy co

nten

t was taken

from M

icroso

ft ® an

d ed

ited an

d re-fo

rmatted

.

Additional Pivot Table Topics

3

Page 70: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

66

Drop areas

The blue outlined regions you see when you finish the steps of the Pivot Table and Pivot Chart wizard. To lay out a Pivot Table report, you drag fields from the field list window and drop them onto the drop areas.

Field list

Field drop-down list

A list of the items available for display in a field. If the field is organized in levels of detail, you

can click or to see which lower-level items are selected for display. A double check mark means that some or all of the lower-level items are displayed.

A window that lists all of the fields available from the source data for use in the Pivot Table report. If a field is organized in levels of detail, you can click or

to show or hide the lower levels. To display the data from a field in the Pivot Table report, drag the field from the field list to one of the drop areas.

Pivot Table Terminology

3 Additional Pivot Table Topics

Page 71: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

67

Data area

The values under qtr1 and qtr 2 are in the data area.

The part of a Pivot Table report that contains summary data for the row and column fields. For example, cell B5 contains a summary of all of the sales amounts for Golf in Qtr1.

Classic format

Indented format

In a Pivot Table report in indented format, the data for each row field is indented. The summarized figures for each data field appear in a single column.

Refresh

To update a Pivot Table report with the most recent data from the source list or database. For example, if a Pivot Table report is based on data from a database, refreshing the report runs the query that retrieves data for the report. For reports based on worksheet data, when you change the worksheet data, you can click a button to refresh the report with the changes.

Pivot Table Terminology

Pivot T

able T

ermin

olo

gy co

nten

t was taken

from M

icroso

ft ® an

d ed

ited an

d re-fo

rmatted

.

Additional Pivot Table Topics

3

Page 72: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

68

About calculations and formulas in Pivot Tables

Pivot Table and Pivot Chart reports provide several types of calcula-tions. Data fields use summary functions to combine values from the underlying source data. You can also use custom calculations to compare data values, or add your own formulas that use elements of the report or other worksheet data.

How PivotTables Summarize Data

Source data

The values in the data area summarize the underlying source data in the report.

Pivot Table report made from the above source data

The Month column field provides items March and April. The Re-gion row field provides items North, South, East, and West. The value at the intersection of the April column and the North row is the total sales revenue from the records in the source data that have Month values of April and Region values of North.

3 Additional Pivot Table Topics

Page 73: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

69

Calculations and options available in a report depend on whether the source data came from an OLAP1 database or another type of database.

OLAP source data For reports that are created from OLAP cubes2, the summarized values are pre-calculated on the OLAP server before Microsoft Excel displays the results. Therefore, you cannot change how these values are calculated from within the report. You cannot change the summary function used to calculate data fields or subtotals, or add calculated fields or calculated items. If the OLAP server provides calculated fields, known as calculated members, you'll see these fields in the PivotTable field list. You'll also see any calculated fields and calculated items that are created by macros that were written in Visual Basic for Applications and stored in your workbook, but you won't be able to change these fields or items. If you need additional types of calculations, contact your OLAP database administrator.

Other types of source data In reports based on other types of external data or on worksheet data, Microsoft Excel uses the Sum summary function to calculate data fields that contain numeric data, and the Count summary function to calculate data fields that contain text. You can choose a different summary function— such as Average, Max, or Min— to further analyze and customize your data. You can also create your own formulas that use elements of the report or other worksheet data, by creating a calculated field or a calculated item within a field.

Hidden items in totals For OLAP source data, you can include or exclude the values for hidden items when calculating subtotals and grand totals. For other types of source data, values for hidden items are excluded by default, but you can optionally include the hidden items from page fields.

About calculations and formulas in Pivot Tables

How the type of source data affects calculations

1OLAP: A database technology that has been optimized for querying and reporting, instead of processing transactions. OLAP data is organized hierar-chically and stored in cubes instead of tables.

2CUBE: An OLAP data structure. A cube contains dimensions, like Country/Region/City, and data fields, like Sales Amount. Dimensions organize types of data into hierarchies with levels of detail, and data fields measure quanti-ties.

Pivot T

able C

alculatio

n co

nten

t was taken

from

Micro

soft ®

and ed

ited an

d re-fo

rmatted

.

Additional Pivot Table Topics

3

Page 74: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

70

Custom Formula Syntax In Pivot Tables

You can create formulas only in reports that are not based on OLAP source data.

Formulas are available in PivotChart reports and use the same syntax as those in PivotTable reports. For best results when working in a PivotChart report, create and edit formulas in the associated PivotTable report, where you can see the individual values that make up your data, and then view the results in the PivotChart report.

Formula elements In formulas you create for calculated fields and cal-culated items, you can use operators and expressions as you do in other worksheet formulas. You can use constants and refer to data from the re-port, but you cannot use cell references or defined names. You cannot use worksheet functions that require cell references or defined names as argu-ments, and you cannot use array functions.

Names in reports Microsoft Excel provides names to identify the ele-ments of a report in your formulas. The names are composed of the field and item names. In the following example, the data in range C3:C9 is named Dairy.

In a PivotChart report, the field names are displayed in the field buttons, and item names can be seen in each field drop-down list. Don't confuse these names with those you see in chart tips, which reflect series and data point names instead.

Examples A calculated field named Forecast could forecast future orders with a formula such as the following:

=Sales * 1.2

A calculated item in the Type field that estimates sales for a new product based on Dairy sales could use a formula such as the following:

=Dairy * 115%

3 Additional Pivot Table Topics

Page 75: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

71

About calculations and formulas in Pivot Tables

Pivot T

able C

alculatio

n co

nten

t was taken

from

Micro

soft ®

and ed

ited an

d re-fo

rmatted

.

Formulas operate on sum totals, not individual records Formulas for calculated fields operate on the sum of the underlying data for any fields in the formula. For example, the formula =Sales * 1.2 multiplies the sum of the sales for each type and region by 1.2; it does not multiply each individual sale by 1.2 and then sum the multiplied amounts. Formulas for calculated items, however, operate on the individual records; the calcu-lated item formula =Dairy *115% multiplies each individual sale of Dairy times 115%, after which the multiplied amounts are summarized together in the data area.

Spaces, numbers, and symbols in names In a name that includes more than one field, the fields can be in any order. In the example above, cells C6:D6 can be 'April North' or 'North April'. Use single quotation marks around names that are more than one word or include numbers or symbols.

Totals Formulas cannot refer to totals (such as March Total, April Total, and Grand Total in the example).

Field names in item references You can include the field name in a reference to an item. The item name must be in square brackets— for ex-ample, Region[North]. Use this format to avoid #NAME? errors when two items in two different fields in a report have the same name. For example, if a report has an item named Meat in the Type field and another item named Meat in the Category field, you can prevent #NAME? errors by re-ferring to the items as Type[Meat] and Category[Meat].

Referring to items by position You can refer to an item by its posi-tion in the report as currently sorted and displayed. Type[1] is Dairy, and Type[2] is Seafood. The item referred to in this way can change whenever the positions of items change or different items are displayed or hidden. Hidden items are not counted in this index.

You can use relative positions to refer to items. The positions are deter-mined relative to the calculated item that contains the formula. If South is the current region, Region[-1] is North; if North is the current region, Re-gion[+1] is South. For example, a calculated item could use the formula =Region[-1] * 3%. If the position you give is before the first item or after the last item in the field, the formula results in a #REF! error.

In calculated item formulas, if you refer to items by their position or rela-tive position, any options you have set under Top 10 AutoShow and AutoSort options in the PivotTable Sort and Top 10 or PivotTable Field Advanced Options dialog boxes are reset to Off or Manual, and the options become unavailable.

Additional Pivot Table Topics

3

Page 76: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

72

Steps:

⇒ If items in the field to which you want to add the calculated item are grouped, ungroup them.

⇒ Select the field or an item in the field to which you want to add the calcu-lated item.

⇒ On the PivotTable toolbar, click PivotTable or PivotChart, point to For-mulas, and then click Calculated Item.

⇒ In the Name box, type a name for the calculated item.

⇒ In the Formula box, type the formula for the item.

⇒ To use data from an item in the formula, click the field in the Fields box, click the item in the Items list, and then click Insert Item.

Note: You can include only items from the same field in which you are creating the calculated item.

⇒ Click Add, and then click OK.

Note: If the items were originally grouped and you ungrouped them in step 1, you can group them again or create new groups that in-clude the new calculated item, if you want.

Create Calculated Item In A Pivot Table Or Pivot Chart

3 Additional Pivot Table Topics

Page 77: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

73

Create Calculated Item In A Pivot Table Or Pivot Chart

Notes

Be careful that the Grand Totals do not include both the data items and the new calculated item(s) in its total (unless preferred so). If so, then remove the Grand Totals (see Pivot Table options box) and replace with another calculated item for the Grand Totals.

You cannot change the summary function for fields that contain calculated items.

When a cell in the data area is the intersection of a calculated item and a calculated field, the formula for the calculated field overrides the calculated item formula.

Great Tip!

Additional Pivot Table Topics

3

Page 78: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

74

Create Calculated Field In A Pivot Table Or Pivot Chart

Steps:

⇒ Click a cell in the PivotTable report, or click the PivotChart report

⇒ On the PivotTable toolbar, click PivotTable or PivotChart, point to Formulas, and then click Calculated Field

⇒ In the Name box, type a name for the calculated field

⇒ In the Formula box, type the formula for the field

⇒ To use the data from a field in the formula, click the field in the Fields box, and then click Insert Field

⇒ Click Add, and then click OK

⇒ If necessary, position calculated field where you want it in the report

Note: Formulas for calculated fields always operate on all the available data; you cannot narrow their scope by specifying a particular part of the data in the formula.

When you create a calculated field in a PivotChart report, the formula and its results are reflected in the associated PivotTable report, and vice versa. If you are working with a PivotChart report and plan to create complex formulas, it is recommended that you create the formulas in the associated PivotTable report, where you can see the individual values that make up your data, and then view the results that are plotted in the PivotChart report.

3 Additional Pivot Table Topics

Page 79: Pivot Tables

Microsoft Excel Pivot Table Topics For The Haas School of Business, UC Berkeley - Dash Designs

C H A P T E R

75

Create Calculated Field In A Pivot Table Or Pivot Chart

Additional Pivot Table Topics

3