Sub topic 11
Keeping the pivot table current as data grows
This chapter covers why a pivot table can silently stop including new data and how to prevent that. It assumes you can create a pivot table and place fields in Rows, Columns and Values. It also assumes you know how to check a total against a plain formula.
How a pivot table decides what to include
A pivot table in Google Sheets recalculates on its own. There is no Refresh button. When a cell inside its source range changes, the pivot table updates within moments.
The catch is that the pivot table only reads the source range, the cell range stored in its definition. A row you add outside that range is never read, no matter how obviously it belongs to your data.
You can see the stored range by clicking any cell in the pivot table and looking at the Data range box at the top of the pivot table editor. If it says Sales!A1:E250 and you add row 251, the new record is invisible to the pivot table.
This failure is easy to miss because nothing shows an error. The totals are plausible, only too low.
How the range responds to edits
The range adjusts automatically in some cases and not in others.
| Action in the source sheet | Effect on a fixed range such as `A1:E250` |
|---|---|
| Edit a value inside the range | Pivot table updates |
| Insert a row in the middle of the range | Range grows to `A1:E251` |
| Delete a row inside the range | Range shrinks by one row |
| Type a new row directly below the last row | Not included. The range stays the same |
| Add a new column to the right of the range | Not included |
| Sort the source data | Pivot table is unaffected, because it reads values and not their order |
The row typed below the last row is the most common cause of a stale pivot table. People usually add data at the bottom, and that is the one place a fixed range does not grow.
Use an open-ended range
You can give the pivot table a range with no fixed end row. In the Data range box, type the range with the column letters only:
Sales!A1:Ereads columns A to E from row 1 to the last row of the sheet.Sales!A:Ereads the full columns.
Rows added at the bottom are then included automatically. After you type the range, confirm that the box still shows what you entered and that the totals changed as expected. If the new rows do not appear, check that the range was saved and not rewritten to a fixed size.
Open-ended ranges have costs:
- Any stray content below the data becomes part of the source. A note, a total row or a leftover test value will show up as a record.
- Fully empty rows are included. They typically appear as a
(blank)item in Rows, which you can hide with a filter. The filter must be set to hide blanks, and it does not remove the underlying rows. - You must leave room for columns.
A1:Eignores a new column F. If you expect new fields, useA1:Zand keep columns after the data empty. A pivot table cannot use a column with no header, so an empty header cell in the range raises an error.
Plan for new columns and headers
Every column in the range needs a header in row 1. This is a requirement. If you widen the range to include a column that has no header, the editor reports a problem and the pivot table may not render.
To add a new field, add a header and values in the source sheet first. Then widen the range to include the column, or use a range that already spans it. The new field then appears in the editor's field list for the pivot table.
The reverse also happens. If you rename a header in the source, any rule in the pivot table that used the old name, such as a filter or a calculated field, may lose its link to the column. Check these after renaming.
Use a Google Sheets table as the source
If your data lives in a Google Sheets table (Format > Convert to table, or Insert > Table), you can build the pivot table from the table. A table grows when you type under its last row. A pivot table whose source is the table range then follows the table.
This removes the need to maintain the range by hand. It also gives each column a defined type and a fixed header. That helps with a related problem: a new row that holds a number as text. Text values are counted but not summed, so your sum and count can disagree.
Tables have limits. Rows still have to be added through the table, either by typing directly below it or through its own features. If another process writes rows elsewhere in the sheet, the table does not capture them. If you are unsure whether your version supports this workflow, test it with a few new rows before you rely on it.
Keep the pivot table away from the data
A pivot table grows as the data grows. More regions or products produce more rows and columns. If something sits in the way, the pivot table cannot expand and displays an error saying it would overwrite cells.
Place each pivot table on its own sheet, starting at A1. Do not place it on the same sheet as the source data, and do not put notes or formulas below or to the right of it. This also makes the next step easier, because the pivot sheet has nothing in it except the pivot table.
Imported and appended data
If the source is itself a formula such as IMPORTRANGE or QUERY, the pivot table can use the output range. The output grows and shrinks, so use an open-ended range such as Data!A1:E.
Check the first row in this case. If the formula does not return a header row, the pivot table treats your first data row as headers. Also be aware that an imported range that returns an error, such as a missing permission, empties the pivot table.
If a form or an automation appends rows, either use an open-ended range or have the automation write into a table. Do not rely on a fixed range here, because nobody will be watching the range box.
Decision guide
Verify that nothing is missing
Do not assume the range is right. Compare the pivot table against the source with an independent count. If the data has an ID in column A, this formula counts the records in the source:
=COUNTA(Sales!A2:A)Next to it, put the pivot table's grand total for a count of the same field, or use SUMIFS for a total. A mismatch means the pivot table is missing rows, or the source has blank rows or text values in a numeric column. The earlier chapter on checking results shows how to use SUMIFS for this.
Make this check a habit after you add a batch of data. You can put the comparison on the pivot sheet, but place it outside the area the pivot table can grow into, such as a few rows above the pivot table or far to the right.
Pivot tables are the right tool when growth is the main concern. If you need a result that adapts to new rows with no maintenance and you are comfortable with formulas, QUERY over an open-ended range such as Sales!A1:E has the same advantage and gives you full control. A pivot table, in turn, is quicker to change by dragging fields.
Common mistakes
- New rows are not included. The range is fixed. Edit the Data range or switch to an open-ended range.
- A
(blank)row appears. An open-ended range includes empty rows. Hide the blank item with a filter, or tidy the source. - A total row is counted as data. A summary row under the data is inside the open-ended range. Move it, or write the source range so that it excludes it.
- Counts and sums disagree. Some values are text. Fix the cells, or format the column as a number.
- The pivot table cannot expand. Another cell sits in its path. Move the pivot table to its own sheet.
Exercise
Your pivot table reads Orders!A1:F400. A colleague pastes 30 new orders starting in row 401, and later adds a new column G named "Discount". The pivot table totals do not change. Explain why, and describe a range and layout that would include both kinds of change in future.
Show answer
The range is fixed, so rows 401 to 430 and column G are outside it, and a pivot table ignores cells outside its source range. Typing below the last row does not extend a fixed range. To include future changes, set the Data range to an open-ended range that covers spare columns, for example Orders!A1:Z, and keep the area below the data free of notes or totals. Give the new column a header in row 1, because a column with no header cannot be used. Alternatively, convert the data to a table and build the pivot table from the table. Then check the result by comparing =COUNTA(Orders!A2:A) with the pivot table's record count.