Sub topic 1
What a PivotTable does and when to use one
Prerequisites
This chapter assumes you can do the following:
- Move around a workbook: open worksheets, select cells and ranges.
- Enter data and write simple formulas such as
=SUM(B2:B6). - Read a list of records laid out in rows and columns.
What a PivotTable does
A PivotTable is an Excel tool that summarises a list of records without changing it. You choose which fields (columns of your data) to group by and which numbers to total. Excel then builds a summary grid. The source data stays untouched, so you can rearrange the summary as often as you like.
Take this small sales list. Each row is one record.
Date,Region,Product,Units,Sales
2025-01-05,East,Widget,10,250
2025-01-12,West,Gadget,4,180
2025-02-03,East,Gadget,7,315
2025-02-14,West,Widget,12,300
2025-03-09,East,Widget,5,125To find total sales per region by hand, you would write several SUMIF formulas. A PivotTable does this with a field layout instead:
Rows: Region
Columns: Product
Values: Sum of SalesThis layout produces a grid of total sales for each region and product combination. If you later want totals by month instead, you move fields. You do not rewrite formulas.
How the pieces fit together
The PivotTable reads the source data and groups the records by the fields you place in Rows and Columns. It then applies a summary calculation, such as Sum, to the Values field in each cell of the grid.
When to use one
A PivotTable fits when you need to answer questions like these:
- What are total sales by region?
- How many orders did each product have each month?
- What is the average sale per region and product?
It works best when your data is a flat list with many records and a few categories to group by. The table below compares it with other approaches.
| Need | Better tool |
|---|---|
| Summarise many records by several categories, and change the grouping often | PivotTable |
| One fixed total, such as sales for East only | `SUMIF` or `SUMIFS` formula |
| Change or correct individual records | Edit the source data directly |
| Report a result that must update the moment data is typed | Formulas, or a PivotTable plus a refresh |
Common errors at this stage
- Expecting live updates. A PivotTable does not recalculate when source data changes. You must refresh it. A later chapter covers this.
- Typing in the summary. The summary grid is generated. You cannot edit its values directly. Change the source instead.
- Poorly shaped source data. Blank header cells, merged cells, or several tables on one sheet cause problems. The next chapter explains how to prepare the data.
Exercise
Using the sample sales list above, which field layout would show total units for each product, with one row per product?
Show answer
Put Product in Rows and put Units in Values, summarised with Sum. The result is 15 Widget units in January and 12 more in February, so 27 in total for Widget. Gadget totals 11.
Exercise
Why would a PivotTable be a poor choice if you only need one fixed total, such as sales for the East region?
Show answer
A single SUMIF formula answers the question directly and updates automatically. A PivotTable adds a separate object that must be refreshed. It pays off when you want to regroup the data in many ways.