Quick answer: To create a pivot table in Excel, click any cell in a list that has one header row, then select Insert > PivotTable. Confirm the range, pick New Worksheet or Existing Worksheet and select OK. In the PivotTable Fields pane, check a text field such as Region to list it in Rows and a number field such as Sales to total it in Values. When the source data changes, right-click the pivot table and select Refresh.
In this guide
- Step 1: Get the source data in shape
- Step 2: Insert the PivotTable
- Step 3: Add fields to Rows, Columns and Values
- Step 4: Change Sum to Count, Average or a percentage
- Step 5: Refresh the PivotTable when the data changes
- Shortcut: let Excel suggest a layout
- Grouping dates by month or year
- Excel for the web and Excel for Mac
- When a pivot table misbehaves
- Related guides
Applies to: Microsoft’s PivotTable article lists Excel for Microsoft 365 (Windows and Mac), Excel for the web, Excel 2024, 2021, 2019 and 2016, plus the 2024 and 2021 Mac versions. The steps below follow Excel on Windows, where Excel calls the feature a PivotTable; the web and Mac get a short section near the end.
A pivot table turns a long list of records into a summary you can rearrange. Instead of writing SUMIF formulas for each region or month, you tell Excel which column to group by and which to total, and it builds the grid for you. Nothing in the source list changes, so you can try several layouts without risk.
Step 1: Get the source data in shape
A pivot table is only as tidy as the list behind it. Microsoft’s guidance for the source data comes down to a few rules:
- Keep the data in columns under a single header row, one record per row.
- Give every column a unique header that isn’t blank. Two columns both called “Amount”, or one with no name at all, can cause trouble when Excel turns headers into field names.
- Avoid a second header row stacked above the first, and avoid merged cells.
- Consider turning the list into an Excel table with Insert > Table before you start.
The table step pays off when the list grows. A pivot table built on a fixed range such as A1:D500 has no reason to look at row 501, while a table expands as you add rows below it, so a refresh can pick up the new records. Microsoft’s page doesn’t spell out how blank rows or columns are handled, but a gap can stop Excel from detecting the whole list when it suggests a range, so close any gaps or check the range in Step 2.
If your sheet has merged headers, Merge and Center not working in Excel explains how to unmerge them. Duplicate records inflate the totals, so if the list was pasted together from several places, run Remove Duplicates on a copy first. For data that is nested or laid out as a cross-tab already, Microsoft points to Power Query, which can unpivot it into a plain list.
Step 2: Insert the PivotTable
- Select the cells you want to summarize, or click a single cell inside the table or range.
- Select Insert > PivotTable.
- In the dialog, check that the PivotTable is based on the table or range you expect. Microsoft lists Add this data to the Data Model as optional, so you can leave it cleared for a single list.
- Choose New Worksheet to give the pivot table a sheet of its own, or Existing Worksheet and click the cell where its top-left corner should go.
- Select OK.
Excel adds an empty pivot table and opens the PivotTable Fields pane on the right. A new worksheet is the safer choice: a pivot table grows and shrinks as you change fields, and on a busy sheet it can run into other data. The arrow on the PivotTable button offers other sources, such as Get from External Data Source and Get from Data Model, for data that lives outside the workbook.
Step 3: Add fields to Rows, Columns and Values
Each column header in your source becomes a field in the PivotTable Fields pane. Select the check box next to a field to add it. According to Microsoft, Excel places it for you: fields with text go to Rows, date and time fields go to Columns as a hierarchy, and number fields go to Values. To put a field somewhere else, drag it from the field list, or from one area box to another, at the bottom of the pane.
The areas do different jobs:
- Rows: one row in the pivot table for each distinct item, such as each region.
- Columns: one column for each item, such as each year, which turns the list into a grid.
- Values: the numbers being summarized for each row and column.
- Filters: a drop-down above the pivot table that limits the whole report, for example to one product line. Microsoft’s PivotTable article doesn’t describe this area, so the label may differ slightly in your version.
Swapping a field between Rows and Columns is a quick way to see the same summary from the other side. If the pane disappears when you click outside the pivot table, click any cell inside it to bring the pane back.
Step 4: Change Sum to Count, Average or a percentage
Microsoft notes that a field in Values is added up by default. If Excel reads the column as text, which can happen when numbers were imported or typed with stray characters, it counts the entries instead. To pick the calculation yourself:
- In the Values area, select the arrow next to the field name, for example Sum of Sales.
- Select Value Field Settings.
- On Summarize Values By, choose the calculation you want, such as Count or Average, and select OK.
Microsoft’s article doesn’t name the options in that list, so check the exact choices in your version. In the same dialog, Show Values As displays a value as a share, such as % of Grand Total, and Number Format formats the whole field at once rather than cell by cell. To show a total and its percentage side by side, drag the same field into Values twice and set each copy differently.
Changing the calculation also renames the field, so Microsoft suggests holding off on custom names until the layout is settled. To strip the “Sum of” prefix from the headers in one go, it recommends Ctrl+H (Find and Replace).
Step 5: Refresh the PivotTable when the data changes
A pivot table doesn’t recalculate like a formula. It works from a snapshot of the source, so edits to the list don’t show until you refresh it:
- One pivot table: right-click any cell in it and select Refresh.
- Several pivot tables: click a cell in any of them, go to the PivotTable Analyze tab, select the arrow under Refresh and choose Refresh All.
The PivotTable Analyze tab appears only while a cell in the pivot table is selected, and Microsoft’s grouping article calls it both Analyze and PivotTable Analyze, so the label may differ in your version. If new rows still don’t appear after a refresh, the pivot table may be pointed at a fixed range that ends above them; converting the source to a table (Step 1) or changing the data source to include the new rows should fix that. If a pivot table’s numbers stay stuck while ordinary formulas are also stale, Excel formulas not calculating or updating covers the calculation settings.
Shortcut: let Excel suggest a layout
If you’re not sure which fields to use, Excel can propose a few pivot tables built from your data. In current Windows versions, click inside the list and select Insert > Recommended PivotTables, then pick a preview and select OK. Microsoft’s PivotTable article mentions PivotTable recommendations and Copilot but doesn’t give these steps, so the button name may vary. The result is an ordinary pivot table: you can change its fields later with Steps 3 and 4.
Grouping dates by month or year
Microsoft says date and time fields go to Columns as a hierarchy when you add them, so a date column may arrive already split into years, quarters or months. Microsoft’s article on grouping PivotTable data gives the steps: right-click a value in the pivot table and select Group, check or edit Starting at and Ending at, pick a time period under By, such as Months, and select OK. To go back to single dates, right-click any item in the group and select Ungroup. That article gives no reason for Group being unavailable, but a cell in the date column that holds text or is empty may stop it, so check the source column.
Excel for the web and Excel for Mac
Microsoft lists Excel for the web and several Mac versions for PivotTables, and its article says pivot tables work differently depending on the platform, with separate tabs for Windows, Web and macOS. Only the Windows steps were reviewed for this guide. The basic flow of Insert, PivotTable, then checking fields in the pane is the same idea everywhere, but dialog options and menu names may not match. If an option described here is missing in your browser, open the workbook in the desktop app.
When a pivot table misbehaves
The causes below are possibilities to check, not a diagnosis.
| What you see | Possible cause | What to try |
|---|---|---|
| “The PivotTable field name is not valid” | A header cell in the source may be blank | Type a name in every header cell (Step 1) |
| Values are counted, not added up | Excel reads the column as text | Fix the numbers in the source, then refresh |
| New rows don’t appear | The source is a fixed range | Convert the list to a table and refresh |
| Edits to the data don’t show | The pivot table hasn’t been refreshed | Right-click it and select Refresh |
| A row labeled (blank) | Some source cells are empty | Fill or remove the empty cells |
| Totals look too high | The source has duplicate records | Remove duplicates on a copy, then refresh |
Microsoft’s PivotTable article doesn’t list error messages, so the first and fifth rows are based on the header and blank-cell rules in Step 1 rather than on a documented cause. If a filter in the source list hides rows you expected to see, Excel filter not working may help.
Related guides
- How to remove duplicates in Excel
- Excel filter not working: how to fix it on Windows 11
- Merge and Center not working in Excel: how to fix it
- Excel formulas not calculating or updating: how to fix it
- Excel tips and tricks: 10 ways to work faster in Excel
Leave a Reply