Pivot Table Issues

How to Retrieve PivotTable Values When Rows Change After Refresh

John WilsonJohn Wilson Oct 15, 2026 868 views

Question details

The user needs a reliable formula to extract data from a dynamically updating PivotTable where the sequence and number of items change after a refresh.

How to Retrieve Dynamic PivotTable Values When Data Changes After Refresh
Product
Spreadsheet
Device & OS
not provided
Scenario
Populating a secondary summary table using data from a Power Query-backed PivotTable that dynamically changes its row count and order.
Observed behavior
Standard position-based formulas pull incorrect data because the physical row locations of specific data points (like cities) shift whenever the source data is refreshed.
Before you start

Ensure your source data or PivotTable utilizes structured references (like a defined Table Name) so your lookup formulas can adapt to changing ranges without returning errors.

Solution 1Recommended

Use INDEX and MATCH to Lookup by Exact Labels

This is the most reliable method. It fetches values based on row and column headers instead of physical cell positions, making it immune to sorting or filtering changes.

By nesting the MATCH function inside the INDEX function, you force the spreadsheet to look for specific text (such as a city name) regardless of what row it currently occupies. The IFERROR wrapper ensures that if a city disappears from the dataset after a refresh, your summary table shows a zero instead of breaking.

1
Identify your lookup criteria

Determine the cell in your destination table that contains the row label (e.g., $A2 for the city name) and the column header (e.g., B$1).

2
Enter the INDEX and MATCH formula

In your target cell, use a formula similar to this: =IFERROR(INDEX(Table1,MATCH($A2,Table1[City],0),MATCH(B$1,Table1[#Headers],0)), 0). Adjust 'Table1' and 'City' to match your actual structured table names.

3
Combine multiple columns if necessary

If you need to sum two specific columns dynamically, you can add two INDEX/MATCH functions together: =IFERROR(INDEX(Table1,MATCH($A2,Table1[City],0),MATCH(B$1,Table1[#Headers],0)) + INDEX(Table1,MATCH($A2,Table1[City],0),MATCH(C$1,Table1[#Headers],0)), 0).

4
Drag to fill

Drag the fill handle down to apply the formula to the rest of the rows in your destination table.

Use INDEX and MATCH to Lookup by Exact Labels
Absolute Referencing: Pay attention to the dollar signs ($). Using $A2 locks the column but allows the row to change, while B$1 locks the row but allows the column to change. This makes copying the formula across your table seamless.
Advanced Data Management

Handle Dynamic PivotTables Flawlessly with WPS Spreadsheet

WPS Office provides robust data analysis capabilities, fully supporting dynamic arrays, advanced lookup functions (like INDEX and MATCH), and comprehensive PivotTable configurations to streamline your reporting.

  1. 1. Open your data file: Launch WPS Spreadsheet and open your existing .xlsx workbook containing the PivotTable.
  2. 2. Refresh your connections: Navigate to the Data tab and click 'Refresh All' to instantly update your PivotTable with the latest data.
  3. 3. Insert lookup formulas safely: Use the built-in Formula builder to easily construct your INDEX and MATCH functions, ensuring accurate data retrieval no matter how the row layout changes.
100% compatibility with Microsoft Excel (.xlsx) formats and structured referencesSeamless processing of advanced formulas like IFERROR, INDEX, MATCH, and SUMPRODUCTLightweight software that handles large datasets and complex calculations quicklyFree to use with an intuitive, tabbed user interface
QA img-9

Frequently Asked Questions

Why shouldn't I just use standard cell references like =B5?

When a PivotTable refreshes, new items might be added, or existing items might be re-sorted. If 'New York' moves from row 5 to row 7, the formula =B5 will start pulling data for a different city, silently corrupting your final reports.

Why use structured table references (e.g., Table1[City]) instead of normal ranges?

Structured references automatically expand and contract as rows are added or removed from your source dataset. This means you won't have to manually update your formula ranges every time the data size changes.

Can I use GETPIVOTDATA instead of INDEX/MATCH?

Yes, GETPIVOTDATA is explicitly designed to retrieve data from a PivotTable based on item names. However, if an item disappears entirely after a refresh, GETPIVOTDATA will return a #REF! error. You must wrap it in IFERROR to handle dynamic, missing data smoothly.

How do I stop my column widths from resizing when I refresh the PivotTable?

Right-click anywhere inside the PivotTable, select 'PivotTable Options', and uncheck the box labeled 'Autofit column widths on update'. This will lock your layout in place.