Sub topic 1
What a PivotTable does and when to use one
A PivotTable summarises a long list of records into a compact table. You choose which fields become row labels, column labels and calculated values. Excel then groups the records and computes the totals. This chapter explains the working model, shows when a PivotTable is the right tool, and lists the mistakes that cause most early problems. Later chapters cover each step of building one.
Prerequisites
This chapter assumes you already know:
- How to move around a workbook and select cells and ranges.
- How to enter data and write simple formulas such as
=SUM(B2:B6). - That a list of records in a spreadsheet has one row per record and one column per attribute.
You do not need to know any PivotTable features yet.
The problem a PivotTable solves
Suppose you have five sales records. Each row is one sale.
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,125You want to know how much each region sold of each product. With five rows you could do this by eye. With 50,000 rows you would write many SUMIFS formulas, one for each combination. Adding a new region or product would mean adding more formulas by hand.
A PivotTable does this in one step. You tell Excel which fields to arrange, and it finds the distinct values, groups the records and calculates the totals.
Rows: Region
Columns: Product
Values: Sum of SalesThis layout produces the following grid.
| Region | Gadget | Widget | Grand Total |
|---|---|---|---|
| East | 315 | 375 | 690 |
| West | 180 | 300 | 480 |
| Grand Total | 495 | 675 | 1170 |
East Widget is 375 because two records match: 250 and 125. Your source data is unchanged. The PivotTable is a separate report built from it.
The working model
A PivotTable is a view over a copy of your data. Four ideas explain how it behaves.
- Fields come from column headers. Each header in the source becomes a field you can place in the report. Excel reads only the header text and the values beneath it.
- Each field goes to an area. The four areas are Rows, Columns, Values and Filters. Row and column fields supply the category labels. Values supplies the numbers to calculate. Filters restricts the whole report to a subset of records.
- Excel groups, then summarises. For each combination of row and column labels, Excel collects the matching records. It then applies a summary function to the value field, such as Sum, Count or Average.
- The result is cached. Excel stores a snapshot of the source data, called the pivot cache, inside the workbook. The PivotTable reads from this cache. It does not read the worksheet directly.
The fourth point matters in practice. If you edit the source data, the PivotTable does not change until you refresh it. This is the most common reason people think a PivotTable is wrong.
What a PivotTable is good at
Use a PivotTable when your question has the form "total, count or average of X, broken down by Y and Z". Typical cases:
- Sales by region and product.
- Number of support tickets by month and priority.
- Average order value by customer segment.
- Headcount by department and location.
Its strengths are:
- Speed of exploration. You can move a field from Rows to Columns by dragging it. This lets you test several views of the same data in seconds.
- No formulas to maintain. New categories in the data appear after a refresh. You do not edit any formulas.
- Consistent grouping. Excel treats
EastandEastas the same label. It does not make arithmetic mistakes when it combines them. - Built-in drill-down. Double-clicking a result cell shows the records behind it on a new sheet.
When another tool is a better fit
A PivotTable is not always the right choice. Compare these situations:
| Situation | Better choice | Reason |
|---|---|---|
| You need one number, such as total West sales | `SUMIFS` | A single formula is simpler than a report |
| You need a fixed, formatted report layout | Formulas on a report sheet | A PivotTable layout shifts as the data changes |
| You need row-by-row calculations | A helper column in the source | A PivotTable summarises records and does not edit them |
| The data is millions of rows or comes from several related tables | Power Pivot or a database | A standard PivotTable uses one flat source |
| You need to edit values in the result | The source data | PivotTable value cells cannot be typed over |
A PivotTable can also be read by formulas through GETPIVOTDATA. That is covered in a later chapter.
Common errors at this stage
Most early problems come from the source data, not from the PivotTable itself.
- Blank header cells. A column with no header cannot become a field. Excel will refuse to create the PivotTable or will name the field automatically.
- Numbers stored as text. Excel counts such a column instead of summing it. A left-aligned number or a green corner triangle in the cell is a typical sign.
- Blank rows inside the data. Excel may stop reading the list at the blank row and miss the records below it.
- Subtotal or total rows in the source. These rows are read as records and are counted twice.
- Expecting live updates. Changing a source cell does not change the PivotTable until you refresh it.
Checking your understanding of the model
You can test your model with the sample data. If you drag Product to Rows and leave Region out, the report lists only products. Gadget totals 495 and Widget totals 675, because the region is ignored. If you also drag Date into Rows, each product splits further by date. The numbers do not change. Only the level of detail changes. This is the main skill in PivotTable work: choosing the level of detail that answers the question without burying it.
Exercise
Using the five sample records in this chapter, a PivotTable has Product in Rows and Sum of Units in Values. What are the two results, and what happens to them if you change the Units value in the source worksheet without refreshing?
Show answer
Gadget is 11 (4 + 7) and Widget is 27 (10 + 12 + 5). If you change a Units value in the source without refreshing, the PivotTable keeps showing 11 and 27. It reads from the pivot cache, which is a snapshot, and the numbers update only after a refresh.
Exercise
A colleague needs the total sales for one region, shown in a single cell inside a formatted monthly report. Should they use a PivotTable? Give one reason for your answer.
Show answer
Probably not. A single SUMIFS formula gives the number directly. A PivotTable layout can shift when categories are added, so it is a weak base for a fixed report. They could still use a PivotTable to explore the data first.