How to make a pivot table in Excel
You have a long sheet of sales, expenses or attendance, and you want to know the total per month, per product or per city. A pivot table does it with no formulas and a few clicks.
What is a pivot table good for?
A pivot table is a separate summary table that Excel builds from your raw data. You only tell it what goes in the rows, what goes in the columns, and what to add up or count. It never changes your data, so you can experiment freely.
It answers questions like: what was the revenue per month, which product earned the most, how many orders came from each city, how much did each person spend per category.
Preparation: how the data should look
A pivot table works smoothly when the data is tidy. Check these four things first:
- Every column has a unique, non-empty header in the first row (for example Date, Product, City, Amount).
- There is no completely blank row or column in the middle of the data.
- There are no merged cells or subtotal rows scattered through the data.
- Each column holds one kind of value: numbers stored as numbers, dates stored as dates, not as text.
Click into the data and press Ctrl + T. Excel converts the range into a table that grows with new rows, so the pivot table will still see data you add later.
Step 1: Insert the pivot table
- Click any cell inside your data.
- On the Insert tab, click PivotTable.
- In the dialog, check that the selected range covers all your data.
- Choose New Worksheet and click OK.
An empty pivot table appears with the PivotTable Fields pane on the right. If the pane is hidden, click inside the empty pivot area.
Step 2: Drop fields into the four areas
At the bottom of the pane there are four areas. Drag field names onto them from the list above:
| Area | What it does | Example |
|---|---|---|
| Rows | What you group the rows by | Product |
| Columns | What you group the columns by | Month |
| Values | What you summarise | Sum of revenue |
| Filters | A field that filters the whole table | City |
Try it: drag Product to Rows and Amount to Values. You instantly see total revenue per product. Drag Month to Columns and the table gets a monthly breakdown.
Step 3: Change how values are summarised
Excel adds up numbers and counts text by default. To change that, click the field in the Values area and choose Value Field Settings. Here you can switch to average, count, maximum or minimum.
On the Show Values As tab you can also ask for percentages, for example what share of total revenue each product makes up.
Grouping dates
If the rows show daily dates but you need monthly totals, right-click a date, choose Group, and select Months (and Years if needed). Newer versions of Excel often do this automatically.
Refreshing: Excel won't tell you on its own
When you change the source data or add a row, the pivot table does not update automatically. Right-click it and choose Refresh, or press Alt + F5. If your source is a table (see above), new rows are included.
Common problems and fixes
| What you see | Likely cause | Fix |
|---|---|---|
| A count instead of a sum | The numbers are stored as text, or the column has a blank cell | Convert the column to numbers, fill the blanks, then refresh |
| An error about a field name when inserting | One column has an empty header | Give every column a header |
| New rows don't show up | The source range didn't grow with the data | Turn the source into a table (Ctrl + T), or change the data source on the PivotTable Analyze tab |
| Dates can't be grouped | A text value or a blank is in the date column | Fix the dates so they are real dates, and fill the blanks |
If you don't want to build everything by hand
The Insert tab also has a Recommended PivotTables button. Excel offers ready-made pivot tables tailored to your data, and you pick the closest one. It is a good way to learn too: see which field landed in which area, then refine from there.
This guide uses menu names from Microsoft 365 and Excel 2021. Older versions follow the same steps, but buttons may sit in slightly different places.
Stuck in a program?
Pointlark sees your screen, answers out loud, and shows you where to click. Hold Ctrl + Win, ask, and follow the blue dot. Coming soon for Windows 10 and 11.
Notify me