8 Pivot Tables and Data Summaries
Learn how to prepare data, build and interpret pivot tables, choose appropriate summaries, and validate results.
What pivot tables summarize
A turns detailed records into a flexible summary. It groups records by selected fields and calculates summaries for each group. Moving fields between areas changes the view of the same data without changing the source records.
Prepare the
Start with a clean, rectangular source-data table. Give every column a unique, nonblank header; use one row per record and one column per variable; and avoid merged cells and blank or within the data. Keep in each column consistent in type—for example, do not mix dates and text in a date column—and include the full range of records you want summarized.
These practices help spreadsheet programs identify fields and summarize them as intended. A sales table, for example, might use one row per transaction and for Date, Region, Product, Units, and Revenue.
Build the
In Excel, select a cell in the source table and choose Insert > PivotTable. In Google Sheets, select the source range and choose Insert > . Both applications let you arrange fields into areas for , , , and , although their labels vary slightly.
: Choose categories that define groups, such as
Region.: Choose categories to display across the top for comparison, such as
Product.: Choose what to calculate for each group, such as the of
Revenue.: Choose which records to include in the view, such as one year or sales channel.
A field can often be moved between areas to change the view. A field in and a field in both define groups; their positions determine how the summary is laid out.
Choose the right summary
Common summaries include , , and ; some spreadsheet tools also offer minimum, maximum, and other calculations. Numeric fields commonly default to , while text or mixed and non-numeric may be counted instead. Check the selected summary rather than assuming the default is appropriate.
For the sales example, each calculation answers a different question:
of Revenue answers, “What was total revenue?”
of transactions answers, “How many records are represented?”
of Revenue answers, “What was the mean revenue per record?”
of Units answers, “How many units were sold?”
These questions are not interchangeable. Averaging transaction revenue gives the transaction value, not revenue per unit. For a group, calculate revenue per unit by dividing its total revenue by its total units:
Group and compare results
Suppose a source table contains these records:
East, Tea: Revenue
East, Coffee: Revenue
West, Tea: Revenue
West, Coffee: Revenue
Place Region in , Product in , and Revenue in , summarized by . The result is:
East: Coffee , Tea , row total
West: Coffee , Tea , row total
Column totals: Coffee , Tea ; Grand Total
The view shows totals by region and product, as well as row and column totals. Move Product to or remove it to ask a different question. Add more row fields, such as Salesperson beneath Region, to show finer groups. When the spreadsheet application supports it, suitable dates or numeric can also be grouped into broader periods or intervals.
Pivot tables can also show as a percentage of a row, column, or grand total. For example, showing each product's revenue as a percentage of the grand total makes its share of all revenue easier to compare. Identify the denominator: percent of grand total and percent of region total answer different questions.
Filter and explore
A pivot-table filter narrows the source records that contribute to a summary, for example by showing only one region or a date range. Groups can also be sorted by their labels or summarized to help reveal the largest or smallest categories. Some spreadsheet tools offer interactive or slicers.
Explore by starting with a broad summary and then adding or removing one field at a time. Compare a total with its subgroups, change the aggregation, or filter the records to investigate a pattern. Excel and Google Sheets allow you to inspect the underlying records contributing to a summarized cell, though the interaction differs by application.
Follow an analysis workflow
Use a question-led workflow to create and check a useful summary:
Ask a specific question. For example, “Which product generated the most revenue in each region?”
Check the source. Confirm the headers and data types, check for missing , and make sure the source range includes all relevant records.
Create the . Put
Regionin ,Productin , andRevenuein ; summarize Revenue by .Refine the view. Add a date filter or group dates by an appropriate period; sort by revenue if useful.
Validate the result. Check whether the grand total makes sense against the , and confirm that the aggregation and match the question.
Refresh after source changes. New or edited may require refreshing the . If the source range did not include new , update the range as well.
Check for common pitfalls
Check for common problems before interpreting or reporting a summary:
Wrong aggregation: A instead of a may indicate that are stored as text or have inconsistent types. Check the field and summary setting.
Double-counting: If each source row is not a distinct record for the question, summing every row may inflate totals. Check what one row represents before interpreting the result.
Misleading averages: An of group averages is not necessarily the overall when groups contain different numbers of records. Use the underlying observations or a correctly weighted calculation when needed.
Unnoticed : A filtered summarizes only the included records. Review filter selections before reporting results.
Stale or incomplete data: Refresh after source edits, and ensure the source range covers the records intended for analysis.