Excel guide · 4 min read
How to create a pivot table in Excel
Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Date | Region | Rep | Product | Units | Revenue |
| 2 | Sep 3, 2026 | East | Priya | Desk | 4 | 1196 |
| 3 | Sep 11, 2026 | West | Marco | Chair | 10 | 1490 |
| 4 | Sep 18, 2026 | East | Dana | Chair | 6 | 894 |
| 5 | Sep 25, 2026 | North | Owen | Lamp | 12 | 540 |
| 6 | Oct 2, 2026 | West | Marco | Desk | 3 | 897 |
| 7 | Oct 9, 2026 | East | Priya | Lamp | 8 | 360 |
| 8 | Oct 16, 2026 | North | Owen | Desk | 5 | 1495 |
| 9 | Oct 23, 2026 | West | Lena | Chair | 7 | 1043 |
| 10 | Oct 30, 2026 | East | Dana | Desk | 2 | 598 |
| 11 | Nov 4, 2026 | North | Owen | Chair | 9 | 1341 |
| 12 | Nov 6, 2026 | West | Lena | Lamp | 15 | 675 |
| 13 | Nov 12, 2026 | East | Priya | Chair | 4 | 596 |
Download this sheet as an Excel practice file (.xlsx)
Step 1: Get the data in shape
Your boss wants revenue by region and product for the last quarter, by 5. You have a sales log: one row per sale, with Date, Region, Rep, Product, Units and Revenue. That's exactly the shape a PivotTable wants.
Three things make or break it. Every column needs a header. No blank rows or columns in the middle. And each column holds one kind of thing, so Revenue has only numbers, with no "n/a" or totals mixed in.
Turn the data into a table first: click inside it and press Ctrl+T. When you add next week's sales below, the table grows and the PivotTable picks them up on refresh.
Step 2: Insert the PivotTable and drag fields
The Fields pane has four boxes. Rows lists one line per value, Columns makes one column per value, Values does the math and Filters narrows the whole table. Drag Region to Rows and Revenue to Values, and you have totals by region.
To check a pivot, compare one number with a formula. =SUMIF(B2:B13,"West",F2:F13) gives 4,105, the same as the West row. The other regions are East 3,644 and North 3,376, for a grand total of 11,125.
- Click any cell in the data.
- Go to Insert > PivotTable. Check the range or table name, choose New Worksheet, and click OK.
- In the PivotTable Fields pane, drag Region to Rows and Revenue to Values.
- Drag Product to Columns for a region by product grid. West shows 2,533 for Chair, 897 for Desk and 675 for Lamp.
- Not sure where to start? Insert > Recommended PivotTables shows a few ready-made layouts for your data.
Result: 4105
4,105: the West total, matching the West row in the PivotTable.
Step 3: Group dates by month
Drag Date into Rows and recent versions of Excel group it for you, into Years, Quarters and Months. If you see one row per day instead, right-click any date in the PivotTable, choose Group, select Months (and Years if the data crosses a year) and click OK.
Here September has 4,120, October 4,393 and November so far 2,612. Grouping only works when every cell in the Date column is a real date. One date stored as text and Excel refuses with "Cannot group that selection".
The formula check for one month uses SUMIFS with a date window: on or after the 1st, before the 1st of the next month.
Result: 4393
4,393: October revenue, the same as the Oct row of the grouped PivotTable.
Step 4: Sum vs Count, and % of total
Excel picks Sum when every cell in the field is a number, and Count when there's a blank or a bit of text in it. If your Revenue shows "Count of Revenue", right-click a value, choose Summarize Values By > Sum, then go back and clean the column.
The same menu gives Average, Max and Min: the average East sale is 728.80. For shares, right-click a value and choose Show Values As > % of Grand Total. East is 32.8% of revenue, North 30.3% and West 36.9%.
To sort, right-click a value and choose Sort > Sort Largest to Smallest. To change number formats for the whole field, use Value Field Settings > Number Format rather than formatting the cells, so the format sticks after refresh.
Result: 0.3275505618 shows as 32.8% with Percent format
About 0.328: East's share of total revenue, the same as % of Grand Total in the pivot.
Step 5: Refresh, and the formula alternative
A PivotTable doesn't update on its own when the data changes. Right-click it and choose Refresh, or use Data > Refresh All. If you didn't use a table and added rows below the range, use PivotTable Analyze > Change Data Source to include them.
Typing = and clicking a pivot cell creates a GETPIVOTDATA formula instead of a plain reference. It keeps working when the layout moves, but it can't be filled down. To turn it off, go to PivotTable Analyze > Options (the arrow) and untick Generate GetPivotData.
Prefer formulas that update without refresh? In Excel 365, one cell can build the same summary. Newer Microsoft 365 builds also have GROUPBY and PIVOTBY, which do the same in one function.
Result: spills 3 rows × 2 columns
| East | 3644 |
| North | 3376 |
| West | 4105 |
East 3,644, North 3,376, West 4,105: a live regions table that updates as soon as the data changes.
Common mistakes
New rows don't show up
PivotTables need a refresh, and a plain range doesn't grow. Use a table (Ctrl+T) as the source and Refresh All.
Count of Revenue instead of Sum
The column has blanks or text. Switch to Summarize Values By > Sum and fix the stray cells in the data.
Blank rows or merged headers in the data
Excel may pick only part of the data or name a field "Column1". Remove blank rows and unmerge headers before inserting.
Can't group dates
At least one cell in the Date column is text or blank. Convert text dates, then refresh and group again.
FAQ
How do I add a filter to a pivot table?
Drag a field to the Filters box to filter the whole table from a drop-down above it. For buttons people can click, use PivotTable Analyze > Insert Slicer.
How do I show the top 5 in a pivot table?
Click the arrow on Row Labels, choose Value Filters > Top 10, change it to 5 Items by your value field, and click OK.
Why does my pivot table say (blank)?
There are empty cells in a field you put in Rows or Columns, or the source range includes empty rows below the data. Fill or remove them, or filter (blank) out with the Row Labels arrow.
How do I delete a pivot table?
Click inside it, go to PivotTable Analyze > Select > Entire PivotTable, and press Delete. The source data is not touched.
Functions used
SUMIFAdds cells that matchSUMIFSAdds with several conditionsSUMAdds numbersDATEBuilds a dateHSTACKJoins arrays side by sideSORTSorts a range, spillsUNIQUERemoves duplicates, spillsAVERAGEIFAverages cells that match
Related guides
- How to sum by category in Excel
- SUMIF with multiple criteria in Excel (SUMIFS)
- How to sum by month in Excel
- How to calculate percentage of total in Excel
- How to freeze panes in Excel
- How to sum by day of the week in Excel
- How to SUMIF across multiple columns in Excel
Updated