Sub topic 3
Summarize the Data with Pivot Tables
Assume you have a clean sales table on a tab named Data. It has one header row and columns such as Order ID, Order Date, Region, Category, Units, and Revenue. You should already know how to select a range and enter a basic formula.
A pivot table is a summary table that groups source rows and calculates totals or counts. It does not change the source data. Instead, it creates a separate view that you can use for charts and dashboard figures.
Create a pivot table
- Open the
Datatab and click any cell inside the source table. - Select Insert > Pivot table.
- Confirm the data range, such as
Data!A1:F1000. - Choose New sheet and click Create.
- In the Pivot table editor, add fields to Rows, Columns, Values, or Filters.
Start with a revenue summary by region:
- Add
Regionto Rows. - Add
Revenueto Values. - Set the value summary to SUM.
Google Sheets creates one row for each region and a total row. The result might look like this:
| Region | SUM of Revenue |
|---|---|
| East | 420.00 |
| West | 450.00 |
| Grand Total | 870.00 |
Use Rows for the groups you want to compare. Use Values for the measurements. For example, add Category to Rows and Units to Values to show units sold by category.
Choose useful summaries
The same source table can support several pivot tables. Create separate summaries when each one answers a different dashboard question.
| Question | Rows field | Values field | Summary |
|---|---|---|---|
| Which regions produce the most revenue? | Region | Revenue | SUM |
| Which categories sell the most units? | Category | Units | SUM |
| How many orders came from each region? | Region | Order ID | COUNTA |
| How does revenue change by month? | Order Date | Revenue | SUM |
COUNTA counts non-empty cells. It works well for order IDs when each row represents one order. If an order can occupy multiple rows, count a unique order identifier instead of assuming that row count equals order count.
Summarize by two dimensions
To compare categories inside each region:
- Add
Regionto Rows. - Add
Categoryto Columns. - Add
Revenueto Values.
This creates a cross-tab. Each row represents a region, each column represents a category, and each cell contains the revenue for that combination.
A cross-tab is useful when the comparison matters more than a single ranking. It can also provide a compact source for a stacked column or heatmap-style chart.
Group dates into periods
For a time summary:
- Add
Order Dateto Rows. - Add
Revenueto Values and use SUM. - In the pivot table, open the date field menu.
- Choose Create pivot date group, then select a period such as Month, Quarter, or Year.
Group dates only when the source values are real dates. Text that looks like a date may sort alphabetically or fail to group. Check the source column's format and correct invalid values before building the pivot table.
Check the pivot before using it
Verify that the grand total matches a trusted total from the source data. Check that blank regions or categories are intentional. If a field is missing from the editor, confirm that the source range includes its header and all relevant rows.
Name each pivot sheet or table clearly, such as Pivot_Region_Revenue or Pivot_Monthly_Revenue. Clear names make it easier to select the correct range when you create charts and connect slicers later.
Exercise
You need a pivot table showing total units for each category and region. Which fields belong in Rows, Columns, and Values?
Show answer
Put Category in Rows, Region in Columns, and Units in Values with the summary set to SUM.