How to Create a Simple PivotTable in Excel (Windows and Web)

Aseem Kishore
·
9 min read

Help Desk Geek is reader-supported. We may earn a commission when you buy through links on our site. Learn more.

You’ve got a sheet with hundreds of sales rows and you need totals by month or brand, fast. A PivotTable in Excel builds that summary in seconds without a single formula, and building it doesn’t edit your source rows.

Create a PivotTable in Excel for Windows

These steps work in Excel for Microsoft 365, Excel 2024, Excel 2021, and Excel 2019 on Windows. Newer Microsoft 365 builds have extra options, but the basic workflow is the same. Grab the sample spreadsheet if you want to follow along. It’s a small online phone shop’s sales log with Month Sold, Brand, Model, Warehouse Location, and Sale Price columns.

Excel worksheet with the phone sales sample data: Month Sold, Brand, Model, Warehouse Location, and Sale Price columns with JAN and FEB rows for Apple and Samsung phones

Two months in, the shop owner wants three answers. Which month sold more phones? Apple or Samsung? How much money came in each month? One PivotTable answers all three.

Step 1: Turn your data into an Excel Table

A PivotTable reads the first row of your data as field names. Messy source data is the top reason a PivotTable gives strange results, so check these first:

  • One header row, with a unique, nonblank heading for every column
  • One record per row
  • No completely blank rows or columns inside the data
  • No merged cells
  • The same kind of data in each column (numbers stay numbers, dates stay dates)

Then convert the range to a Table. This matters if you’ll add rows later, because a Table grows automatically, so the PivotTable includes the new rows the next time you refresh it (Step 9).

  1. Click any cell in your data.
  2. Press Ctrl + T.
  3. Make sure My table has headers is checked, then click OK.
  4. On the Table Design tab, type a name in the Table Name box, such as PhoneSales.
Create Table dialog in Excel with "My table has headers" checked, sample sales data selected behind it

Your data should now have banded rows and filter arrows on every header.

Step 2: Insert the PivotTable

  1. Click any cell inside the table.
  2. On the ribbon, click Insert > PivotTable. In Microsoft 365, the button may open a small menu; choose From Table/Range.
  3. Check that the Table/Range box shows your table name (for example, PhoneSales).
  4. Select New Worksheet so the summary has room to breathe.
  5. Click OK.
Excel Insert tab with PivotTable button highlighted and the "PivotTable from table or range" dialog showing Table/Range set to PhoneSales and New Worksheet selected

The dialog title varies slightly between versions, but the options are the same. Excel opens a new sheet with an empty PivotTable on the left and the PivotTable Fields pane on the right. Microsoft’s Create a PivotTable to analyze worksheet data page covers the same flow.

Step 3: Learn the four areas in the Fields pane

The bottom half of the PivotTable Fields pane has four boxes. You build the report by dragging field names into them, or by checking a field’s box to let Excel place it.

AreaWhat it doesExample
FiltersFilters the whole reportShow only one warehouse
ColumnsSpreads values across the topMonths as column headings
RowsLists values down the sideOne row per brand
ValuesAdds up or counts the numbersTotal sale price
PivotTable Fields pane listing Month Sold, Brand, Model, Warehouse Location, and Sale Price above empty Filters, Columns, Rows, and Values areas

Step 4: Count phones sold per month

  1. Drag Month Sold into the Rows area.
  2. Drag Brand into the Values area.
PivotTable Fields pane with Month Sold in Rows and Count of Brand in Values, and the resulting PivotTable showing JAN and FEB counts

Because Brand is text, Excel counts it. You’ll see Count of Brand with one number per month, which is the number of phones sold. Dragging Model or Warehouse Location into Values gives the same numbers, since Excel is counting rows either way. The shop sold more phones in JAN (8) than in FEB (7), 15 in total.

Step 5: Compare Apple and Samsung

You don’t need a new PivotTable for the next question. Reuse this one.

  1. Drag Month Sold out of the Rows area and drop it anywhere on the worksheet to remove it.
  2. Drag Brand into the Rows area. Leave Count of Brand in Values.
PivotTable with Brand in Rows and Count of Brand in Values, showing Apple and Samsung row counts

The report now shows how many phones each brand sold. Apple comes out ahead of Samsung, 9 phones to 6.

Step 6: Total the sales for each month

  1. Drag Brand out of both Rows and Values.
  2. Drag Month Sold back into Rows.
  3. Drag Sale Price into Values.
PivotTable with Month Sold in Rows and Sum of Sale Price in Values, showing $7,550 for JAN and $7,100 for FEB

Sale Price holds real numbers, so Excel sums it instead of counting it. You should see $7,550 for JAN and $7,100 for FEB.

Step 7: Change the calculation or number format

Excel picks Sum for numbers and Count for text. You can switch it.

  1. In the Values area, click the drop-down arrow next to Sum of Sale Price.
  2. Select Value Field Settings.
  3. Pick Sum, Count, Average, Max, Min, or another option.
  4. Click Number Format, choose Currency, and click OK.
  5. Click OK again.
Value Field Settings dialog in Excel with Summarize value field by list showing Sum, Count, Average, Max, Min, and the Number Format button visible

Microsoft lists every available calculation on its Calculate values in a PivotTable page.

Step 8: Try more layouts and filters

Now play with it. Drag Brand into Columns while Month Sold stays in Rows, and you get a grid of sales by brand and month. Drag Warehouse Location into Filters, and a drop-down appears above the report so you can view one warehouse at a time.

PivotTable with Warehouse Location filter set to All, Month Sold in Rows, Brand in Columns, and Sum of Sale Price showing JAN 3,750 and 3,800, FEB 5,500 and 1,600

For clickable filter buttons, click inside the PivotTable and choose PivotTable Analyze > Insert Slicer. Date columns can use Insert Timeline instead. In some versions the tab is called Analyze or Options.

Step 9: Refresh after the data changes

A PivotTable doesn’t update itself when you edit the source data. This trips up nearly everyone at least once.

  1. Click inside the PivotTable.
  2. Click PivotTable Analyze > Refresh, or press Alt + F5.

To refresh every PivotTable and data connection in the workbook, use Refresh All (Ctrl + Alt + F5).

Create a PivotTable in Excel for the web

Excel for the web handles the basics well and adds suggested layouts. It doesn’t support Power Pivot, and some connections and layout commands behave differently from desktop Excel.

  1. Open your workbook in Excel for the web and select the table or range.
  2. Click Insert > PivotTable.
  3. In the Insert PivotTable pane, either pick one of the recommended PivotTables or choose to create your own.
  4. Choose a new or existing sheet and create the report.
  5. Drag fields into Rows, Columns, Values, and Filters exactly as in the desktop steps above.
Excel for the web in a browser with the Insert PivotTable pane open, showing recommended PivotTables and the option to create your own

Check recommended PivotTables before trusting them. Excel sometimes picks a Count where you wanted a Sum, or groups by a field that doesn’t answer your question. Microsoft explains the web version on the same create a PivotTable page.

Excel for Mac uses the same Insert > PivotTable workflow, though Power Pivot and some external-data features aren’t available there.

When your PivotTable won’t behave

Built the report and something looks wrong? These are the usual culprits, simplest first.

Fix #1: Bring back the missing PivotTable Fields pane

The pane disappears when you click outside the PivotTable or close it by accident.

  1. Click any cell inside the PivotTable.
  2. Right-click and choose Show Field List.

You can also click PivotTable Analyze > Field List. The pane should reappear on the right.

Fix #2: Refresh so new rows show up

You added rows, hit refresh, and they’re still missing. That means the PivotTable is pointed at a fixed range that doesn’t include them.

  1. Click inside the PivotTable.
  2. Click PivotTable Analyze > Change Data Source.
  3. Type your table name (for example, PhoneSales) in the Table/Range box, or reselect the full range.
  4. Click OK, then click Refresh.

Converting the source to a Table (Step 1) stops this from happening again.

Fix #3: Make Excel sum numbers instead of counting them

If your sales column shows Count of Sale Price, Excel thinks some of those cells are text. Common causes are numbers stored as text, blank strings, error values like #N/A, or typed currency symbols.

  1. Go back to the source data and select the column.
  2. Look for cells with a green triangle in the corner, click the warning icon, and choose Convert to Number.
  3. Delete or fix any error values.
  4. Refresh the PivotTable.
  5. If it still counts, drag the field out of Values and drag it back in.

Fix #4: Fix dates that won’t group by month or year

Right-clicking a date and choosing Group fails with “Cannot group that selection” when even one cell in the column is text or blank.

  1. Filter the source date column and look for blanks or text entries.
  2. Fix or remove them so every cell holds a real Excel date.
  3. Refresh the PivotTable.
  4. Right-click a date in the PivotTable, choose Group, and pick Months, Quarters, or Years.

Fix #5: Find a field that’s missing from the list

Check that the column is inside the source range and has a unique, nonblank header. Refresh the PivotTable after renaming any headers. If the field is in the list but not in the report, a filter is probably hiding it, so open the filter arrows in Rows and Columns and select (Select All).

Fix #6: Keep formatting from resetting after a refresh

Column widths jumping around on every refresh is annoying, but you can switch it off.

  1. Right-click inside the PivotTable and choose PivotTable Options.
  2. On the Layout & Format tab, uncheck Autofit column widths on update.
  3. Check Preserve cell formatting on update.
  4. Click OK.

Microsoft’s layout and format guide covers subtotals, grand totals, and report layouts. If a report needs a rigid layout every month, a formula-based sheet might suit you better.

Where to go next

Once the basics click, a few related tools build on the same report:

  • PivotCharts: Click inside the PivotTable, then Insert > PivotChart. The chart stays linked, so filtering the PivotTable changes the chart too. See Create a PivotChart.
  • Copilot in Excel: Eligible Microsoft 365 subscription accounts can ask Copilot to build a PivotTable from data formatted as a table or supported range (Microsoft’s Copilot PivotTable guide). Double-check the source, the aggregation, and any filters it picks.
  • Multiple tables: If sales, products, and customers live in separate tables, load them into the Data Model and connect them with relationships. PivotTables won’t combine unrelated sheets just because the columns share a name. Microsoft explains this in Use multiple tables to create a PivotTable.
  • Power Query: Use it when the hard part is cleaning or combining data each month. Power Query tidies the data, then the PivotTable summarizes it.

Lookups solve a different problem. They pull matching values from another table rather than summarizing. If that’s what you need, read up on VLOOKUP, its more flexible cousin INDEX-MATCH, or XLOOKUP if you’re on Microsoft 365, Excel 2024, or Excel 2021.

Conclusion

Formatting your data as a Table first (Step 1) fixes most PivotTable headaches before they start. It takes ten seconds and keeps new rows inside the PivotTable’s source, so a refresh picks them up. If your totals still look wrong after that, check the source column for numbers stored as text, since a Count where you expected a Sum points there almost every time.