Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Clean Up a Pivot Table in Excel

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To clean up a pivot table in Excel, first refresh it so the numbers are current, then use the PivotTable Analyze and Design tabs to remove blanks, tidy field names, fix number formats, and re-lay out the rows and columns. The exact buttons vary slightly by Excel version and platform, but the core tools are the same on Windows, Mac, and Excel for the web. Before you start, make sure your source data has a single header row, no blank rows or columns, and consistent date and number formats; a pivot table can only be as clean as the data it summarizes.

What You'll Need

  • Excel 2016 or later, Microsoft 365, or Excel for the web. The steps below use the desktop ribbon; the web version has a reduced set of options.
  • A pivot table that is already built from a source range or an Excel Table.
  • Access to the source data, in case you need to fix headers, blanks, or mixed formats before refreshing.

Step-by-Step

  1. Refresh the pivot table first. Click any cell inside the pivot table, then go to PivotTable Analyze > Refresh (or press Alt+F5 on Windows). If the source data changed, this makes sure you are cleaning up current numbers, not stale ones. On Mac, the Refresh button is on the PivotTable Analyze tab as well.
  2. Check the source range. Go to PivotTable Analyze > Change Data Source and confirm the range covers every row and column you want. If you add rows to the source later, either extend the range or, better, convert the source to an Excel Table (Insert > Table) so the pivot table picks up new rows on refresh.
  3. Remove blank rows and blank labels. In the PivotTable Fields pane, right-click a field in the Rows or Columns area and choose Field Settings, then Layout & Print. Untick "Show items with no data" if you do not want empty categories. To hide the blank row that appears when a source cell is empty, filter the field in the pivot table and untick "(blank)", or fix the empty cells in the source data.
  4. Rename the field headers. Click the header cell in the pivot table (for example "Sum of Sales") and type a cleaner label such as "Total Sales". Do not type over the field name in the PivotTable Fields pane; that renames the underlying field and can break other reports. Renaming the cell in the sheet is safe.
  5. Apply a number format. Right-click a value cell, choose Number Format, and pick Currency, Accounting, Percentage, or Number with the decimals you want. This applies to the whole value field, not just one cell, so the table stays consistent.
  6. Sort and filter the way you want. Use the drop-down arrow on a row or column label to sort A to Z, Z to A, or by value. Use Value Filters to show only the top items or to hide zeros. Clear any leftover filters with PivotTable Analyze > Clear > Clear Filters.
  7. Change the layout. On the Design tab, choose Report Layout > Show in Tabular Form for a flat, database-style look, or Show in Outline Form for indented groups. Use Subtotals to turn group subtotals on or off, and Grand Totals to control the overall totals row and column.
  8. Remove empty cells and error values. Go to PivotTable Analyze > Options (or right-click > PivotTable Options), then the Layout & Format tab. In "For empty cells, show" type 0 or a dash. In "For error values, show" type a blank or a note. This cleans up #DIV/0! and blank-looking cells without touching the source.
  9. Adjust column widths and wrap text. Select the pivot table columns, then use Home > Format > AutoFit Column Width. For long labels, turn on Wrap Text and set a row height. Avoid merging cells inside a pivot table; it breaks refresh and filtering.
  10. Apply a style. On the Design tab, pick a PivotTable Style, and use Banded Rows or Banded Columns for readability. Keep Header Row and Total Row ticked so the structure stays clear.
  11. Refresh and save. Press Refresh once more to confirm the layout survives, then save the workbook. If the pivot table is on its own sheet, rename the sheet tab to something descriptive.

Common Mistakes

  • Typing over field names in the PivotTable Fields pane. This renames the source field and can break formulas or other pivot tables that use it. Rename the header cell in the sheet instead.
  • Leaving blank rows in the source data. Excel treats a blank row as the end of the range, so later rows get ignored on refresh. Delete blank rows or use an Excel Table.
  • Mixing text and numbers in one column. Values stored as text are counted, not summed, so totals look wrong. Convert them with Text to Columns or by multiplying by 1 in a helper column.
  • Merging cells inside the pivot table. Merged cells break sorting, filtering, and refresh. Use Center Across Selection if you need a visual merge.
  • Forgetting to refresh after editing the source. The pivot table keeps old numbers until you refresh, which makes cleanup look like it did not work.

Tips

  • Convert the source range to an Excel Table before building the pivot table; new rows are then included automatically on refresh.
  • Use Tabular Form with Repeat All Item Labels (Design > Report Layout) when you plan to copy the pivot table into another report.
  • Keep one pivot table per sheet if you need different layouts; multiple pivot tables sharing a cache can fight over field settings.
  • Use Slicers (PivotTable Analyze > Insert Slicer) instead of filter drop-downs for a cleaner dashboard look.
  • If you only need the final numbers, copy the pivot table and paste as Values into a new sheet, then format that copy freely.

Troubleshooting

  • The pivot table will not refresh. Check that the source range still exists and has not been deleted or moved. Go to Change Data Source and re-select the range. If the workbook is shared or the file is on a network drive, close and reopen it.
  • New source rows are missing. The range was not extended. Either change the data source to include the new rows or convert the source to an Excel Table.
  • Numbers show as text or totals are wrong. Look for cells with a green triangle or left-aligned numbers in the source. Convert them to numbers, then refresh.
  • Blank row will not go away. There is an empty cell in the source field. Fill it with a label such as "Unassigned" or filter out "(blank)".
  • Field settings are greyed out. The pivot table may be part of a group of pivot tables sharing a cache, or the workbook may be in a protected view. Close other pivot tables that share the cache or enable editing.
  • Layout changes revert after refresh. Column widths and some formatting are not always preserved. Reapply AutoFit after refresh, or paste the pivot table as values into a formatted copy.

Frequently Asked Questions

How do I remove the "Sum of" prefix from a pivot table header?

Click the header cell in the sheet and type a new label. Do not rename the field in the PivotTable Fields pane, because that changes the source field name.

Why does my pivot table show blank rows?

Blank rows appear when a source cell in a row or column field is empty, or when "Show items with no data" is enabled. Fill the empty cells or turn that option off in Field Settings.

Can I clean up a pivot table in Excel for the web?

Yes, but the web version has fewer layout options. Basic refresh, field changes, number formats, and sorting work; advanced layout and some Design options are only in the desktop app.

How do I stop the pivot table from resizing when I refresh?

Go to PivotTable Options > Layout & Format and untick "Autofit column widths on update". Then set your column widths manually.

Why are my totals wrong after cleanup?

Usually the source has numbers stored as text or duplicate rows. Check the source column format and remove duplicates, then refresh.

Can I delete the source data after building the pivot table?

No. The pivot table reads from the source on every refresh. If you delete the source, the pivot table cannot update and may show errors.