Quick answer
To make a pivot table, click any cell in your data and choose Insert > PivotTable, then click OK to put it on a new sheet. In the PivotTable Fields pane, tick a text field such as Region and it goes to Rows; tick a number field such as Amount and it goes to Values, where Excel adds it up. You get one row per region with its total, and you can drag fields between the areas to change the summary at any time.
A sales log with a few hundred rows tells you little until you add it up by region or by month. A pivot table does that in a few clicks, without a formula, and dragging a field turns the same data into a different summary.
What a pivot table does
A pivot table groups the rows of a list that share a value and summarizes a number column for each group. Every row whose Region is East goes into one group, and its amounts are added together. Each column of your list becomes a field, named after its header.
You decide the layout by putting fields in four areas. Rows lists one row per value of a field, Columns does the same across the top, Values holds the numbers being summarized (added up, by default), and Filters limits the whole report to, say, one year.
A pivot table works from a copy of your data that Excel keeps with it, called the PivotTable cache. That’s why it doesn’t change when you edit the list: you refresh it to read the data again.
Before you start: get the data in shape
A pivot table needs a plain list: one header row with a name in every column, one record per row, and no blank rows or subtotal rows inside the data. Merged cells get in the way too. If the list ends in a total row, leave that row out of the source, or the pivot table counts every sale twice.
It helps to turn the list into an Excel table first: click a cell in it and press Ctrl+T (Cmd+T on a Mac). A pivot table built on a table takes in the rows you add later.
How to make a pivot table
Say you look after a furniture supplier’s sales log. Each row is one sale, with its region, its product and the amount. You want the total for each region.
- Click any cell in the list.
- On the Insert tab, click PivotTable. The window that opens, PivotTable from table or range, already shows your list’s range in the Table/Range box.
- Leave New Worksheet selected and click OK. Excel adds a sheet with an empty pivot table and opens the PivotTable Fields pane on the right.
- Tick Region. It’s text, so Excel puts it in Rows.
- Tick Amount. It’s a number, so Excel puts it in Values as Sum of Amount.
You can also drag a field from the list at the top of the pane into an area at the bottom. On Windows, the keyboard route is Alt, N, V, T: press the keys one after another, not together. The arrow under PivotTable also offers other sources, such as an external data source or the Data Model.
On a Mac, Insert > PivotTable opens Create PivotTable, and the rest works the same way, with the pane on the right and a PivotTable Analyze tab for the commands below. In Excel for the web, Insert > PivotTable opens a pane instead of a window. If you’d rather start from a suggestion, Insert > Recommended PivotTables shows a few layouts built from your data.
Add a second field to Columns or Filters
Drag Product to Columns, and the pivot table becomes a grid: regions down the side, products across the top, and the amount for each pair where they meet. East’s chairs come to $2,190 here. Drag Product to Filters instead, and a drop-down above the report lets you show one product at a time.
Dates have one extra behavior. Tick a date field and Excel puts it in Rows and groups the dates into periods such as months for you (Excel 2016 and later). To group by hand, right-click a date in the pivot table and choose Group.
Change Sum to Count, Average or a percentage
Click the field in the Values area and choose Value Field Settings. On the Summarize Values By tab, pick Count to count sales instead of adding them, or Average, Max or Min. You can also right-click any number in the pivot table and use Summarize Values By.
For each region’s share of the total, open the Show Values As tab (or right-click > Show Values As) and choose % of Grand Total. East’s $4,170 becomes 39%.
Refresh a pivot table when the data changes
A pivot table doesn’t update when you change the list, and it doesn’t warn you either. Microsoft is testing an automatic refresh with Microsoft 365 Insiders; until that reaches everyone, refresh by hand after an edit:
- On Windows, click in the pivot table and choose PivotTable Analyze > Refresh, press Alt+F5, or right-click it and choose Refresh. Ctrl+Alt+F5 refreshes everything in the workbook.
- On a Mac, choose PivotTable Analyze > Refresh.
Rows you add below a plain range stay out until you widen the source with PivotTable Analyze > Change Data Source. If the source is an Excel table, new rows come in at the next refresh. To refresh each time the file opens, tick Refresh data when opening the file in PivotTable Options, on the Data tab.
Filter it with slicers
A slicer is a panel of buttons that filters the pivot table: one button per region, say. Choose PivotTable Analyze > Insert Slicer, tick a field and click OK. Click a button to show that value only, and hold Ctrl as you click to pick several. Slicers work on a Mac too, and Excel for the web can add them to an ordinary pivot table.
Check a pivot table’s totals with SUMIFS
A total that ends up in a report should match the data, and a formula is a quick way to check one. The SUMIFS function adds the amounts on the rows that meet every condition you give it, which is what one cell of a pivot table does.
C2:C8 on the rows where column A says East and column B says Chairs: $1,250 in row 2 and $940 in row 8. In C10, =SUMIFS(C2:C8,A2:A8,"East",B2:B8,"Chairs") returns $2,190.The first range is the one to add up, then each pair names a range and what it must match. With one condition, =SUMIFS(C2:C8,A2:A8,"East") gives East’s $4,170, the same as the pivot table’s first row. When a formula and a pivot table disagree, the usual cause is a row the pivot table hasn’t read yet: refresh it.
Practice this in ProExcel
Total every region's sales of one product with SUMIFS, the way a pivot table with a filter would.
ProExcel checks your answer the moment you press Enter.
The free lesson Total by several conditions with SUMIFS has more of these, and SUMIF and COUNTIFS cover one condition and counting. To practice the pivot table itself, pivot table practice has nine free exercises you build in the browser.
Why a pivot table shows the wrong numbers
It counts instead of adding up
If Values says Count of Amount where you expected a sum, Excel read the column as text. One cell with text in it, such as “n/a” or “TBC”, is enough. Replace the text with a number or empty the cell, refresh, and switch the field back to Sum in Value Field Settings.
New rows are missing
The source still ends where it did when you made the pivot table, or you haven’t refreshed. Refresh, and if that isn’t enough, use Change Data Source, or build the pivot table on an Excel table so the source grows with it.
Every total is too high
The source includes a total row, so each sale is counted twice. Remove the total row from the source range.
“The PivotTable field name is not valid”
A column in the source has no header. Give every column a name, including any you added at the edge of the list, and try again.
Frequently asked questions
How do I refresh a pivot table?
Click inside it and choose PivotTable Analyze > Refresh, or right-click it and choose Refresh. On Windows, Alt+F5 refreshes the pivot table you’re in and Ctrl+Alt+F5 refreshes every one in the workbook.
Why is my pivot table counting instead of summing?
The number column holds text somewhere, even one cell such as “n/a”, so Excel treats the field as text and counts it. Fix that cell, refresh, and set the field back to Sum in Value Field Settings.
How do I show percentages in a pivot table?
Right-click a number in the Values area, choose Show Values As and pick % of Grand Total, % of Column Total or % of Row Total. The numbers become each item’s share, and the Grand Total shows 100%.
Can a pivot table use data from more than one sheet?
Yes, in two ways. On Windows you can add each table to the Data Model and link them with relationships on a shared column, or you can combine the lists into one first, for example with Power Query’s Append. Excel for Mac doesn’t have the Data Model.
How do I count unique values in a pivot table?
On Windows, tick Add this data to the Data Model when you create the pivot table. Value Field Settings then offers Distinct Count, which counts each value once.
Practice this with real formulas
ProExcel's free course turns each idea into a formula you type yourself, checked the moment you press Enter. Five minutes a lesson, on your phone or computer.