|
|
by Jon Peltier, MVP
Introduction
One of the most powerful features of Microsoft Excel is the Pivot Table. Pivot tables allow rapid, dynamic, flexible data analysis. Pivot charts add to the flexibility of pivot tables, allowing the same rapid analysis of displayed data, while sacrificing substantial flexibility of normal Excel charts. This article describes how to create pivot tables and pivot charts, and how to create normal charts from pivot tables.
Pivot Table Database
The source data range for a pivot table must be arranged in a list, which has each record (observation) in a single row, each field (variable) in a single column, a header row with names of the fields, and no blank rows or columns. The following sample data shows monthly sales figures for Reps 1 and 2 in the North region and Reps 3 and 4 in the South region.
Sample Pivot Table Database Month | Region | Rep | Amount | Jan | North | Rep 1 | 7 | Jan | North | Rep 2 | 8 | Jan | South | Rep 3 | 3 | Jan | South | Rep 4 | 3 | Feb | North | Rep 1 | 5 | Feb | North | Rep 2 | 3 | Feb | South | Rep 3 | 5 | Feb | South | Rep 4 | 8 | Mar | North | Rep 1 | 8 | Mar | North | Rep 2 | 6 | Mar | South | Rep 3 | 7 | Mar | South | Rep 4 | 6 | Making a Pivot Table
Note: The precise steps to making a pivot table vary slightly from version to version of Excel. These instructions were written based on Excel 2000, but the actual procedure is substantially the same in all versions.
To make a pivot table, select either the entire source data range, or a single cell within this range, and choose Pivot Table and Pivot Chart Report... from the Data menu. The various parts of the Pivot Table Wizard verify that the data is from an Excel database and ask whether to create a pivot table or pivot chart, then ask whether the pivot table shall be created on a new worksheet or on an existing sheet. I find it easier to create the pivot table alone, and add a pivot chart (or regular chart) later. If I'm making a relatively small pivot table from a small database, I usually place the pivot table onto the same sheet as the database; otherwise I'll put the pivot table onto its own sheet.
The most important part of a pivot table is its layout. The layout can be designed by clicking the Layout button on the last step of the Pivot Table Wizard, or directly within the worksheet. Drag the Pivot Field buttons into the appropriate area (Page, Row, Column, or Data) of the pivot table.
Pivot Table Wizard's Layout Dialog
Pivot Table Wizard's Layout Dialog A sample pivot table is shown below: the Month and Region fields are in the Row area of the pivot table, the Rep field is in the column area, and the Amount field is in the data area. There are no page fields identified in this example. The data area of the pivot table allows several options for the fields it contains, including Sum, Average, Min, Max, and Count; this example keeps the default Sum of Amount.
Note that when a cell within a pivot table is selected, the different areas of the pivot table are highlighted with a thick blue border.
Sample Pivot Table The default pivot table has row and column grand totals, and intermediate subtotals for the Months. The Pivot Table menu on the Pivot Table toolbar has some useful items: Wizard which reruns the Pivot Table Wizard on the active pivot table, Table Options which includes whole-table settings, such as row and column totals, and Field Settings which includes formatting and subtotal settings for the individual pivot fields. Double clicking on a pivot field button also invokes the Field Settings dialog. I like to simplify my pivot tables by removing subtotals and grand totals, as shown in the following example.
Pivot Table without Subtotals or Grand Totals The dropdown arrows on the pivot field buttons display a list of pivot items belonging to that field. You can change whether a pivot item is visible using the checkboxes in the list.
Dropdown Showing Pivot Items within a Pivot Field The layout of an existing pivot table can be changed by rerunning the Pivot Table Wizard, or by dragging the pivot field buttons within the pivot table. The following arrangement was made by dragging the Rep field button to the row area of the pivot table.
Realigned Pivot Table The best way to become familiar and comfortable with pivot tables is to practice on a few samples, experimenting with the different options.
|
|