Home > Pivot Table > Calculation > GetPivotData Excel Pivot Table GetPivotData FunctionTo get data from a cell in a pivot table, use Microsoft Excel GetPivotData function to reference pivot table cell. See how to turn off GetPivotData formulas. How to fix GetPivotData formula, to copy it down a column with dynamic references 
GetPivotData FormulaIf you're creating a formula in Excel, and you click on a pivot table value, Excel might create a GetPivotData formula for you, automatically, instead of a normal cell reference. For example, in the screen shot below, I wanted to create a link to cell B5
Why did Excel Create GetPivotData Formula?Usually, if you're building a formula, and you click on a cell, Excel creates a simple link to that cell, like this: =B5 However, if you click on one of the summarized numbers in a pivot table, Excel tries to help you, and it creates a GetPivotData formula. Tips1) Turn it off: If you don't need that automatic formula feature, the short video in the next section shows how to turn it off. (This will affect ALL Excel workbooks on your computer) 2) Fix It: When you drag down a GetPivotData formula, it might show the same result in every row in the range of cells. See how to fix the formula, so it works correctly. 3) Benefits: There are advantages to using GetPivotData, so check out the list of GetPivotData Pros and Cons, before you turn it off forever! 
GetPivotData Pros and ConsThere are advantages and disadvantages (pros and cons) to using GetPivotData, so consider these points, before you decide to use a simple cell reference, instead of a GetPivotData formula. GetPivotData AdvantagesThe GetPivotData function is a highly efficient way to get specific data from a pivot table. Here are a few advantages of using this function to get pivot data.
GetPivotData DisadvantagesThe GetPivotData function can cause problems sometimes. Here are a few of its disadvantages.
When to Use GetPivotDataIf you can't decide when to use GetPivotData, these guidelines might help you. When should you use GetPivotData?
When is a simple formula better?

Simple Link to Pivot CellIf you're creating a formula in Excel, and you click on a pivot table value, Excel might create a GetPivotData formula for you, automatically, instead of a normal cell reference.
Get a Simple Cell ReferenceTo get a simple cell reference to a pivot table value cell:
In this screen shot, I deleted the long formula in cell A9, and typed the cell reference for cell B5. Create GetPivotData FormulaIn the GetPivotData function syntax, there are the following arguments. The first 2 arguments are required:
GetPivotData FormulaIn the screen shot below, the GETPIVOTDATA formula has the following values for its arguments: =GETPIVOTDATA("Total",$A$3,"Product","File Folders")

Ex 2) Cell References For Value FieldCell references work well for the pivot fields and pivot items, but can cause problems if you try to refer to a data field. In this example, cell E2 contains the word "Qty", and you'd like to refer to that cell, instead of having "Qty" in the GetPivotData formula. However, if you change the first argument, data_field, to a reference to cell E2, the result is a #REF! error =GETPIVOTDATA(E2,$A$3,"Product","Paper") Add an Empty StringTo fix this problem, you can concatenate an empty string ( "" ) at the beginning or end of the cell reference: =GETPIVOTDATA(E2&"",$A$3,"Product","Paper") With that simple change to the formula, it returns the correct result. 
GetPivotData Examples  Using DatesTo prevent errors for dates, you can use one of the following methods, and there are detailed examples below:  Match the pivot table's date format  Use the DATEVALUE function  Use the DATE function  Refer to a cell with a valid date  Use the TEXT function Match Date and Date FormatTo get the correct results when typing a date in the GetPivotData formula, use the same date format that is shown in the pivot table. In cell E4, the formula uses the date format that's in the pivot table  dd/mmm/yy  and the result is the correct quantity for that date: =GETPIVOTDATA("Quantity",$B$3,"OrderDate","01/Jan/13") Use DATEVALUE FunctionInstead of just typing the date in the formula, add the DATEVALUE function to the date. In cell E4, the date is entered within the DATEVALUE function  and the result is the correct quantity for that date: =GETPIVOTDATA("Quantity",$B$3,"OrderDate",DATEVALUE("1/1/13")) Use DATE FunctionInstead of just typing the date in the formula, use the DATE function to create the date. In cell E4, the date is created within the DATE function  and the result is the correct quantity for that date: =GETPIVOTDATA("Quantity",$B$3,"OrderDate",DATE(2013,1,1)) Refer to Cell With a DateInstead of typing the date in the formula, you can refer to a cell that contains a valid date, in any format recognized as a date by Excel. In cell E4, the formula refers to the date in cell E2  and the result is the correct quantity for that date: =GETPIVOTDATA("Quantity",$B$3,"OrderDate",E2) 
Use TEXT FunctionInstead of just typing the date in the formula, add the TEXT function to the date. In cell E2, the date is entered as text. The formula in cell E4 uses the TEXT function with the date format of "dmmm": =GETPIVOTDATA("Qty",$B$3,"Date",TEXT(E2,"dmmm")) Thanks to Leonid Koyfman for this tip 
Video: Select Specific Pivot Table in GetPivotDataIf you have multiple copies of a pivot table in a workbook, on different sheets, you can use GETPIVOTDATA to pull an amount from a specific pivot table. Watch this video to see the steps, and the written instructions are below the video. Video Timeline
GetPivotData Example: Select Specific Pivot TableIf you have multiple copies of a pivot table in a workbook, on different sheets, you can use GETPIVOTDATA to pull an amount from a specific pivot table. In this example, there are 3 pivot tables:
The pivot tables are set up using consistent names and locations:
On another sheet in the workbook, a data validation drop down list is added in cell C6, showing all the regions, which are also used in the sheet names. Create the FormulaThe GETPIVOTDATA formula will be entered in cell D6, so the first step will be to create a simple formula there:
There is a GETPIVOTDATA formula in the cell, and the cell displays the total sales for the East region. The formula refers to the Total Price field, and to cell B4 on the PT_East sheet. =GETPIVOTDATA("TotalPrice",PT_East!$B$4) Generalize the Sheet ReferenceInstead of leaving the hardcoded reference to the PT_East sheet, you can use the INDIRECT function in the GetPivotData function to create a range reference based on the text in cell C6. The INDIRECT function requires one argument, INDIRECT(ref_text) and returns the range specified by the reference text argument. Each reference in this workbook will begin with "PT_", followed by the range description in cell C6, and ending with "!$B$4". So, in this case, the formula will be: INDIRECT("PT_" & C6 & "!$B$4") Replace the Sheet ReferenceThe final step is to replace the current sheet reference in the GETPIVOTDATA formula, with the INDIRECT formula: =GETPIVOTDATA("TotalPrice",PT_East!$B$4) changes to: =GETPIVOTDATA("TotalPrice",INDIRECT("PT_" & C6 & "!$B$4")) Now, when you change the region in cell C6, the total amount changes in cell D6. It shows the total from the specified pivot table. 
GetPivotData with Custom SubtotalsWith a default subtotal, the GetPivotData function works well, and returns the correct result. In the screen shot below, an equal sign was typed in cell B1, and then the Bars subtotal amount was clicked. A GetPivotData formula was automatically created, and it returns the quantity of Bars sold. =GETPIVOTDATA("Quantity",$A$3,"Category","Bars") However, if the subtotal is a custom function, instead of the default function, the GetPivotData formula might show an error. In the screen shot below, the we rightclicked on the Bars Total label, and clicked Field Settings. Then, Custom was selected for Subtotals, and Sum and Average selected. Now, if you type and equal sign and click on either of the Bars subtotal cells, the result is a #REF! error. The GetPivotData formula looks different too, with square brackets in it. =GETPIVOTDATA($A$3,"Category[Bars;Data,Sum]") To fix the #REF! error, you can remove the "Data," from the GetPivotData formula. In this example, the corrected formula is: =GETPIVOTDATA($A$3,"Category[Bars;Sum]") With that simple change to the formula, the correct result is returned. Top or Bottom SubtotalsThe GetPivotData formulas have different requirements, depending on the location and type of the Subtotals. There are two GetPivotData formula types:
This table summarizes where the formula types can be used, with subtotals shown at the top or bottom, and how many subtotals are allowed in each location. FAQ: GetPivotData Function1) How do I turn off GetPivotData in Excel?To turn off the automatic GetPivotData formulas, follow these steps:
NOTE: This is an applicationlevel setting, and will affect ALL Excel files that you open on your computer. Download the Sample FileDownload the zipped sample file for this tutorial. The file is in xlsx format, and does not contain macros 
More Pivot Table Resources 
Last updated: June 18, 2023 4:22 PM