Sub topic 18
Troubleshooting blank cells, text numbers and stale results
This chapter assumes you can build a PivotTable from a range or an Excel Table, place fields in the Fields pane, and refresh a PivotTable. Most PivotTable problems come from the source data or from a missed refresh, not from the PivotTable itself. The data below contains all three problems.
Date,Region,Product,Units,Sales
2025-01-05,East,Widget,10,250
2025-01-12,,Gadget,4,180
2025-02-03,East,Gadget,7,'315
2025-02-14,West,Widget,12,300The working model
A PivotTable does not read your worksheet live. It stores a copy of the source data, called the pivot cache, and builds the grid from that copy. Two rules follow from this:
- The PivotTable can only be as clean as the source columns. It chooses a summary function for each column from the cell contents.
- The grid shows the cache, so it is out of date until you refresh it.
Blank cells
There are two kinds of blank problem.
- Blank in the source. The second record above has no Region. The PivotTable groups it under an item labelled
(blank). Fix the source by typing a real value such asUnknown, then refresh. - Blank in the grid. A region and product combination with no records shows an empty cell. To display a value, right-click the PivotTable, choose PivotTable Options, and tick For empty cells show. Enter
0or a dash.
A blank header cell is a separate problem. Excel will refuse to create the PivotTable with the message that the field name is not valid. Give every column a unique header.
Text numbers
Sales in the third record is stored as text, because of the leading apostrophe. A text value cannot be summed.
Symptoms:
- The value field defaults to Count of Sales instead of Sum of Sales.
- The Sum total leaves out the text row, so it is too low.
- The cell shows a green triangle, or is left-aligned.
To fix it, correct the source and not the PivotTable. Select the column, use the warning icon's Convert to Number, or use Data > Text to Columns and choose Finish. Then refresh, and change the value field back to Sum if needed.
Stale results
You edit a source cell and the PivotTable does not change. This is expected, because the cache has not been rebuilt. Use PivotTable Analyze > Refresh, or Refresh All for the whole workbook.
If new rows still do not appear after refreshing, the source range is fixed and does not include them. Either convert the source to an Excel Table, or use Change Data Source to extend the range. A Table grows with the data, so this stops recurring.
A macro can refresh everything for you:
Sub RefreshAllPivots()
ThisWorkbook.RefreshAll
End SubQuick diagnosis
| Symptom | Likely cause | Fix |
|---|---|---|
| `(blank)` item in rows | Empty source cells | Fill the source, refresh |
| Count instead of Sum | Numbers stored as text | Convert to numbers, refresh |
| Dates will not group | Dates stored as text | Convert to real dates |
| Edits not shown | Cache not refreshed | Refresh |
| New rows missing | Fixed source range | Use a Table or Change Data Source |
Exercise
A PivotTable shows Count of Sales instead of Sum of Sales, and you changed it to Sum but the total is still too low. What is the cause and the fix?
Show answer
Some Sales values are stored as text, so Sum ignores them. Convert those cells to numbers in the source data (Convert to Number or Text to Columns), then refresh the PivotTable.