How to Use and Compare Excel PivotTable Grand Totals in Formulas and Charts
Question details
The user needs to dynamically reference grand totals from single or multiple PivotTables for use in formulas and charts, ensuring references don't break when tables resize.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Creating charts or comparative formulas using data summaries (grand totals) from various PivotTables that may change size due to data updates or filtering.
- Observed behavior
- Hard-coded references break when the PivotTable expands or collapses, leading to incorrect calculations or chart data.
Ensure your PivotTables are fully refreshed and that the 'Generate GetPivotData' option is enabled in your spreadsheet settings. This will make it much easier to dynamically reference totals without manual typing.
Use GETPIVOTDATA to dynamically extract grand totals
This is the most robust method to prevent reference errors when a PivotTable resizes or is filtered.
By avoiding hard-coded cell references (like =C25), you protect your formulas from breaking. The GETPIVOTDATA function locks onto the actual data field rather than the cell location.
Choose a blank cell outside your PivotTables to act as the dedicated summary range for your formulas and charts.
Type '=' in the blank cell, and then click directly on the Grand Total cell of your PivotTable. The GETPIVOTDATA formula will automatically generate.
Do the same for other PivotTables in adjacent cells. This allows you to easily write comparison formulas (like variances) between them using standard cell references pointing to your new summary area.
Highlight your new summary range, navigate to the Insert tab, and insert a chart. The chart will now dynamically update based on the correct grand totals.
Use a SUMIF workaround formula
Useful if GETPIVOTDATA is disabled or if you prefer a standard range formula to locate the 'Grand Total' text.
Manage and Compare PivotTable Data Easily with WPS Spreadsheet
WPS Spreadsheet provides robust PivotTable functionality, including full support for GETPIVOTDATA, dynamic charts, and advanced data modeling. You can easily summarize and visualize your data without worrying about compatibility issues.
- 1. Open your file: Launch WPS Spreadsheet and open the workbook containing your PivotTables.
- 2. Start the formula: Select any blank cell outside the PivotTable and type an equals sign (=).
- 3. Capture the Grand Total: Click the Grand Total cell inside your PivotTable to automatically insert the GETPIVOTDATA function.
- 4. Insert Chart: Highlight your newly referenced summary data cells, go to the Insert tab, and choose your preferred chart type.

Frequently Asked Questions
Why does my chart data change incorrectly when I filter the PivotTable?
If your chart is based on hard-coded cell references (like =C25), filtering the PivotTable can shrink the table and move the Grand Total to a different cell (like =C15). Using GETPIVOTDATA solves this by locking onto the data field logic rather than the static cell address.
How do I turn on the Generate GetPivotData feature?
Select any cell inside your PivotTable. Go to the PivotTable Analyze (or Options) tab on the top ribbon, click the 'Options' dropdown on the far left, and check the 'Generate GetPivotData' setting.
Can I compare grand totals from PivotTables on different worksheets?
Yes. You can create a master summary sheet and use the GETPIVOTDATA formula to point to Grand Totals on various different worksheets within the same workbook, then use that summary sheet as the source for your charts.
Why does my GETPIVOTDATA formula return a #REF! error?
This error usually occurs if the data field or item you are referencing in the formula is currently hidden by a filter in the PivotTable, or if the underlying field names in the PivotTable were changed.




