5 Pivot Tables
Learn how pivot tables summarize detailed records, how to prepare and arrange their fields, and how to check summaries, groups, and filters.
What a does
A turns detailed records into an interactive summary. It groups records by selected fields and calculates summaries such as sums, counts, or averages without changing the underlying records. Because fields can be rearranged, the same data can be examined from different perspectives.
Prepare the
Reliable summaries begin with well-structured . Use one header row with a distinct name for each column, and put one record in each row. Avoid merged cells and blank within the data.
Keep each column to one kind of information: for example, store dates as dates and sales amounts as numbers. Check for missing or inconsistent entries, such as West, west, and W. being used for the same region.
A sales log might contain the fields Date, Region, Product, Units, and Sales, with each row representing one transaction.
Arrange fields to build a summary
A spreadsheet’s field list or editor commonly provides four areas for arranging fields:
places categories down the left side, such as
Region.places categories across the top, such as
Product.specifies summaries, such as Sum of Sales.
limits which records contribute to the summary, such as by
Year.
For example, placing Region in , Product in , and Sales in produces sales for each region–product combination, along with totals where enabled. The calculates these from the underlying transactions; it does not merely copy selected .
Choose a calculation for
A value field can often be summarized in several ways:
Sum adds numeric .
Count counts nonempty entries, making it useful for counting transactions or records.
Average calculates the mean.
Minimum and Maximum show the smallest and largest .
The default calculation depends on the spreadsheet application and the data type it detects. If a number column is stored as text, the may count entries instead of summing them. When a result looks unexpected, check both the and the selected summary calculation.
Rearrange the report
Move a field between , , , and to change the summary’s layout. For example, put Product in and Region in to turn a report around, or move Product from to to list products vertically.
Adding Date below Region in creates nested detail, such as region followed by transaction date. Removing a field simplifies the report but does not delete the field or the . Row or column categories can also be reordered and sorted by their names or summarized .
Group detailed data
combines detailed items into broader categories, which is useful when individual make a report too long. Depending on the spreadsheet program, selected labels can be grouped manually, while dates and numbers can be grouped according to rules.
Examples include transaction dates by month, quarter, or year; ages into intervals such as 0–9, 10–19, and 20–29; and combining product types into a category such as “Accessories.” Keep groups meaningful and check the date or number range so records are not unintentionally left outside them.
Filter the included records
A filter limits which source records contribute to a summary without deleting those records. You can filter by a field’s items, such as showing only the East and West regions, or by a condition, such as dates in a particular period. A field in provides a report-level control; on row or column labels narrow those categories. Some spreadsheet programs also offer , visible controls for selecting filter .
Check which are active before interpreting or sharing a result. A filtered total describes only the included records and may not represent the whole dataset. In some applications, a value-based filter may need adjustment after new source are added.
Create and verify a useful report
Use this workflow to create and check a report:
Inspect and clean the source table; confirm that headers, dates, and numeric fields are recognized correctly.
Create a from the complete data range.
Place category fields in and, if useful, .
Place a measure in and choose an appropriate calculation, such as Sum, Count, or Average.
Add or to answer a focused question.
Rearrange or sort fields to compare results from another perspective.
Check totals against the , and confirm that displayed and groups match the question.
Refresh or update the when the changes if the spreadsheet does not update it automatically.
To investigate whether monthly sales differ by region, group Date by month, put Region in , place Sales in as Sum, and filter to the period of interest. To compare products instead, move Product into or .