Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

Excel GETPIVOTDATA function

doc getpivotdata function 1

Description

Syntax and Arguments

Usage and Examples


Description

The GETPIVOTDATA function queries a pivot table and returns data based on the pivot table structure.

Syntax and arguments

Formula syntax

=GETPIVOTDATA (data_field, pivot_table, [field1, item1], ...)

Arguments

  • Data_field: Required. Enclosed with double quotas, the field name contains the data you want to return.
  • Pivot_table: Required. A cell or a range of cells or a named range used to determined which pivot table you will retrieve data from.
  • Field1, item1: Optional. 1 to 126 pairs of field names and item names that indirect the data that you want to retrieve. If the filed names and item names are non-numeric value, you need to enclose them with quotation marks.

Return Value

The GETPIVOTDATA function returns data stored in the given pivot table.

Remarks

1) The calculated fields and custom calculation filed such as Grand Total and Sum of EachProwduct also can be as arguments in GETPIVOTDATA function.

2) If an item contains a date or time, the returned value may lose if the workbook is moved to another location and displayed as error value #REF!. For avoid this case, you can express date or time as series number such as show 12/3/2018 as 43437.

3) If argument pivot_table is not a cell or range in which a PivotTable is found, GETPIVOTDATA returns #REF!.

4) If the arguments are not visible in the given pivot table, the GETPIVOTDATA function returns the #REF! error value.

Usage and Examples

Example1: Basic usage of the GETPIVOTDATA function

1) Only first two required arguments:

=GETPIVOTDATA("StoreNorth",$A$3)

Explain:

If there are only two arguments in the GETPIVOTDARA function, it automatically returns the values in Grand Total field based on the given items name. In my example, it returns the Grand Total number of StoreNorth field in pivotable which is placed in Range A3:E9 (begins at Cell A3).
doc getpivotdata function 2

2) With data_field, pivot_table, field1, item1 argument

=GETPIVOTDATA("StoreNorth",$A$3,"Product","B")

Explain:

SouthNorth: data_field, the filed you want to retrieve value from;

A3: pivot_table, the first cell of the pivot table is Cell A3;

Product, B: filed_name, item_name, a pair which describes which value you want to return.
doc getpivotdata function 3


Example2: How to avoid error values if the argument is date or time in GETPIVOTDATA function

If the arguments in the GETPIVOTDATA function contain dates or time, the result may be changed to error value #REF! while the workbook is open in another destination as below screenshot shown:
doc getpivotdata function 4

In this case, you can

1) Use the DATEVALUE function

=GETPIVOTDATA("EachDate",A3,"Date Record",DATEVALUE("12/3/2018"))
doc getpivotdata function 5

2) Use the DATE function

=GETPIVOTDATA("EachDate",A3,"Date Record",DATE(2018,12,3))
doc getpivotdata function 6

3) Refer to a cell with date

=GETPIVOTDATA("EachDate",A3,"Date Record",A12)
doc getpivotdata function 7


Sample File
doc sample file


Excel Productivity Tools

300 Advanced Features Help You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 70% time.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.

Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Office Tab Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.