PivotTables
A PivotTable summarises a table of data, totals by region or counts by month, with no formulas, just by dragging fields. It's one of Excel's most powerful features, and one of the easiest to learn.
The data
PivotTables need data laid out as a simple table: one header row, one row per record, no blank rows or columns, and no merged cells.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Date | Region | Rep | Amount |
| 2 | 03-06-2024 | North | Asha | 1200 |
| 3 | 05-06-2024 | South | Leo | 800 |
| 4 | 11-06-2024 | North | Mei | 450 |
| 5 | 14-06-2024 | East | Asha | 2300 |
| 6 | 18-06-2024 | South | Raj | 650 |
| 7 | 02-07-2024 | North | Asha | 950 |
| 8 | 09-07-2024 | East | Leo | 1600 |
| 9 | 15-07-2024 | South | Raj | 1100 |
Creating a PivotTable
- Click anywhere in the data.
- Choose Insert → PivotTable, and accept the suggested range and a new worksheet.
- In the PivotTable Fields pane, tick or drag fields into the four areas:
| Area | Does |
|---|---|
| Rows | one row in the pivot for each value: each region, each rep |
| Columns | one column for each value |
| Values | the numbers to summarise: Sum of Amount, Count of Rep... |
| Filters | a drop-down that limits the whole pivot to certain records |
Total by region
Drag Region to Rows and Amount to Values:
| Region | Sum of Amount |
|---|---|
| East | 3900 |
| North | 2600 |
| South | 2550 |
| Grand Total | 9050 |
Eight rows became a three-line summary. With eighty thousand rows, it would be just as quick.
Two dimensions
Now drag Date to Columns. Excel groups dates by month automatically (right-click a date and choose Group to pick days, months, quarters or years):
| Region | Jun | Jul | Grand Total |
|---|---|---|---|
| East | 2300 | 1600 | 3900 |
| North | 1650 | 950 | 2600 |
| South | 1450 | 1100 | 2550 |
| Grand Total | 5400 | 3650 | 9050 |
Changing the calculation
Click the field in Values and choose Value Field Settings to summarise differently:
| Summarise by | Gives, per rep |
|---|---|
| Sum | total sales: Asha 4450 |
| Count | number of sales: Asha 3, Leo 2, Mei 1, Raj 2 |
| Average | average sale: Asha 1483.33, Leo 1200, Mei 450, Raj 875 |
| Max, Min | the largest or smallest sale |
On the Show Values As tab, % of Grand Total turns totals into shares: East 43.1%, North 28.7%, South 28.2%.
Filtering and slicers
- Drag Rep to Filters, then pick a rep from the drop-down above the pivot to see only their figures.
- Or use PivotTable Analyze → Insert Slicer for clickable filter buttons, which are friendlier for anyone reading the report.
Keeping it up to date
A PivotTable doesn't recalculate on its own when the data changes. Right-click it and choose Refresh, or use Data → Refresh All. If you added rows beyond the original range, and the data isn't a Table, use Change Data Source to include them.
Charts from a pivot
With the pivot selected, PivotTable Analyze → PivotChart draws a chart that follows the pivot: filter or rearrange the pivot, and the chart changes too.