GETPIVOTDATA in Excel: Pull Numbers From a Pivot Table
By ExcelReady TeamUpdated 6 min read
The short answer
GETPIVOTDATA returns one value from a pivot table by naming what you want instead of pointing at a cell. For example, =GETPIVOTDATA("Sales",$A$3,"Region","North") returns North's total sales. Excel writes it automatically when you click a pivot cell in a formula. It keeps working when the pivot's layout changes, as long as the item is still shown.
Key takeaways
- Syntax: =GETPIVOTDATA(data_field, pivot_table, [field1, item1], ...).
- data_field is the value field's name in quotes; pivot_table is any cell inside the pivot.
- Replace typed items with cell references to build a flexible report.
- GETPIVOTDATA returns #REF! when the item isn't visible in the pivot or a name is misspelt.
- To get a normal reference instead, type the cell address or turn off Generate GetPivotData.
On this page+
GETPIVOTDATA in Excel pulls a single number out of a pivot table by naming it: "Sales for North, Laptop". Instead of pointing at a cell like B5, the formula describes the value, so it keeps working when the pivot is resized or rearranged. This guide is for anyone who builds reports or dashboards on top of pivot tables, or who has seen a long GETPIVOTDATA formula appear and wondered where it came from.
What does GETPIVOTDATA do?#
GETPIVOTDATA returns one value from a pivot table, chosen by field and item names. A field is a column from your source data, such as Region. An item is one value in that field, such as North.
It exists because pivot tables move. When you add a product, filter a region or refresh new data, the cell that held "North, Laptop" can shift to a different row. A plain reference like =B5 would then show the wrong number. GETPIVOTDATA finds the value by name, wherever it is.
You often meet it by accident. When you type = and click a cell inside a pivot table, Excel writes a GETPIVOTDATA formula for you instead of =B5.
GETPIVOTDATA syntax#
The function takes the value field, a cell in the pivot, and then pairs of field and item names:
=GETPIVOTDATA(data_field, pivot_table, [field1, item1], [field2, item2], ...)| Argument | What it means | Example |
|---|---|---|
| data_field | The value field to return, in quotes | "Sales" |
| pivot_table | Any cell inside the pivot table, usually its top-left cell | $A$3 |
| field1, item1 | A field name and the item you want, in pairs | "Region","North" |
You can add as many field and item pairs as the pivot has fields. With no pairs at all, GETPIVOTDATA returns the grand total. Field and item names are not case-sensitive.
Example: pull one total from a pivot table#
Here is a small sales list, the source data:
| A | B | C | |
|---|---|---|---|
| 1 | Region | Product | Sales |
| 2 | North | Laptop | 4,800 |
| 3 | South | Monitor | 1,250 |
| 4 | North | Monitor | 900 |
| 5 | East | Laptop | 3,600 |
| 6 | North | Laptop | 2,400 |
| 7 | South | Laptop | 1,200 |
| 8 | East | Monitor | 1,500 |
A pivot table on another sheet, starting at A3, has Region in Rows, Product in Columns and Sum of Sales in Values:
| Sum of Sales | Laptop | Monitor | Grand Total |
|---|---|---|---|
| East | 3,600 | 1,500 | 5,100 |
| North | 7,200 | 900 | 8,100 |
| South | 1,200 | 1,250 | 2,450 |
| Grand Total | 12,000 | 3,650 | 15,650 |
These formulas pull values from it:
| Question | Formula | Result |
|---|---|---|
| North, Laptop | =GETPIVOTDATA("Sales",$A$3,"Region","North","Product","Laptop") | 7,200 |
| All of North | =GETPIVOTDATA("Sales",$A$3,"Region","North") | 8,100 |
| All Monitors | =GETPIVOTDATA("Sales",$A$3,"Product","Monitor") | 3,650 |
| Grand total | =GETPIVOTDATA("Sales",$A$3) | 15,650 |
If the formula sits on a different sheet from the pivot, the second argument includes the sheet name, such as Pivot!$A$3. The guide to referencing another sheet explains that syntax.
Make GETPIVOTDATA flexible with cell references#
Typed items like "North" lock the formula to one answer. Replace them with cells, and one formula can fill a whole report. Say F2:F4 hold East, North and South, and G1 holds Laptop. In G2:
=GETPIVOTDATA("Sales",Pivot!$A$3,"Region",$F2,"Product",G$1)Fill it down and across. $F2 keeps the column fixed for regions, and G$1 keeps the row fixed for products. This is how many teams build a KPI summary: a neat, fixed layout that reads its numbers from a pivot underneath.
Dates need care. If a field holds real dates, give the item as a date value, such as DATE(2026,3,1), or as a cell that holds the date, not as typed text.
Turn off GETPIVOTDATA when you don't want it#
Sometimes you want a normal reference, for example to fill a formula down next to the pivot. GETPIVOTDATA doesn't adjust when filled, so every row would return the same value. There are two ways around it:
- Type the address. Typing
=B5by hand, instead of clicking the cell, gives a normal reference. - Turn the feature off. On Windows, click inside the pivot, open the PivotTable Analyze tab, click the arrow next to Options and untick Generate GetPivotData. The same setting appears under File > Options > Formulas as "Use GetPivotData functions for PivotTable references". Excel for Mac has an equivalent setting, but its location depends on your version.
If you turn it off, remember that plain references can point at the wrong cell after the pivot changes shape.
Why GETPIVOTDATA returns #REF!#
GETPIVOTDATA returns #REF! when it can't find the value you described. The usual causes:
- The item isn't visible. If North is filtered out, or the Region field was removed from the pivot, the value doesn't exist to return.
- A name is misspelt.
"Regoin"or"Nort"won't match. Copy names from the pivot's field list. - The wrong data field. Use the source field name that Excel writes, such as
"Sales", and check it is in the Values area. - pivot_table points outside the pivot. The second argument must be a cell inside the pivot table.
- The data changed and the pivot wasn't refreshed. A new region won't appear until you refresh (Windows: Alt+F5 for the active pivot). See how to refresh a pivot table.
Wrap the formula in IFERROR, such as =IFERROR(GETPIVOTDATA(...),0), only once you know the #REF! is expected, for example for a product with no sales yet.
GETPIVOTDATA or SUMIFS?#
Both give the same totals. The choice is about where the numbers come from:
- GETPIVOTDATA reads an existing pivot table. It's ideal when the pivot is already the agreed source, or when you need values shown as percentages from the pivot, such as percent of total.
- SUMIFS reads the source data directly.
=SUMIFS(C2:C8,A2:A8,"North",B2:B8,"Laptop")returns the same 7,200 with no pivot and no refresh.
SUMIFS is also a good check: if it matches your GETPIVOTDATA result, your pivot is up to date. The beginner's guide to pivot tables shows how to build the pivot used in this guide.
Practise it#
GETPIVOTDATA only makes sense once you are comfortable with pivot tables themselves. Try the SUMIFS check on this page, then build your first pivot table in a live spreadsheet and go further with report filters and percent-of-total views. Each step is checked instantly, so you'll know your pivot is right before you pull numbers from it.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
GETPIVOTDATA needs a real pivot table, so here is the SUMIFS check you would run against the source data. Click F2 and total Sales (C2:C8) for North and Laptop, then press Enter.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Sales | ||||||
| 2 | North Laptop | ||||||
| 3 | |||||||
| 4 | |||||||
| 5 | |||||||
| 6 | |||||||
| 7 | |||||||
| 8 | |||||||
| 9 | |||||||
| 10 | |||||||
| 11 |
Tip: SUMIFS starts with the range to add (C2:C8), then the Region column with "North" and the Product column with "Laptop".
Practise this in a lesson
Frequently asked questions
Why does Excel put GETPIVOTDATA in my formula?
Excel writes GETPIVOTDATA automatically when you click a cell inside a pivot table while typing a formula. It does this so the formula keeps finding the same value if the pivot changes shape. You can type the cell address instead, or turn the option off.
How do I turn off GETPIVOTDATA in Excel?
On Windows, click inside the pivot table, open the PivotTable Analyze tab, click the arrow next to Options and untick Generate GetPivotData. The same setting is in File > Options > Formulas as Use GetPivotData functions for PivotTable references.
Why does GETPIVOTDATA return #REF!?
Usually the item you asked for isn't visible in the pivot, for example because it's filtered out or the field was removed, or a field or item name is misspelt. The pivot_table argument must also point to a cell inside the pivot.
Can I use a cell reference in GETPIVOTDATA?
Yes. Replace a typed item such as "North" with a cell such as F2. This lets one formula fill a whole report table.
Is GETPIVOTDATA better than SUMIFS?
It depends. GETPIVOTDATA reads a pivot table that already exists and follows it when the layout changes. SUMIFS works straight from the source data, needs no pivot and updates without a refresh.