Please help: Reference error in GETPIVOTDATA (pivot table in another sheet)

Rainbow_P

New Member
Joined
May 6, 2022
Messages
25
Office Version
  1. 365
Platform
  1. Windows
Good day!


Can you please help me with a reference question?

A workbook has 2 sheets. Sheet1 is a pivot table.

In sheet2, I use GETPIVOTDATA to return some values from the pivot table in Sheet1.
In sheet2, cells C2 and D2, there are direct formulas when I just clicked the cells (I want to take) from the pivot table in Sheet1.


C2: GETPIVOTDATA("[Measures].[Car count]",Sheet1!$A$6,"[Customer].[Customer ID]","[Customer].[Customer ID].&[ABC Co., Ltd]","[Customer].[Staff]","[Customer].[Staff].&[David]")
D2: GETPIVOTDATA("[Measures].[Car count]",Sheet1!$A$6,"[Customer].[Customer ID]","[Customer].[Customer ID].&[ABC Co., Ltd]","[Product].[Item]","[Product].[Item].&[Fruit]","[Customer].[Staff]","[Customer].[Staff].&[David]")

Now I want to alter the formulas to make it reference the cells in Sheet2 for Customer ID and Staff.

For example in C2, I tried to change the formula to:

GETPIVOTDATA("[Measures].[Vessels Sold To (Distinct)]",Sheet1!$A$6,"[Customer].[Customer Sub Account]",A2,"[Customer].[Account Manager Name]",B2)

But it doesn't work.

What's the right way to do so? Thank you.



7-4-2023 3-10-34 PM.png
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
For example in C2, I tried to change the formula to:
Hi, that looks like a completely different formula to what you said you had that was working in C2.

For the one you said you had working, you could try like this:
Excel Formula:
=GETPIVOTDATA("[Measures].[Car count]",Sheet1!$A$6,"[Customer].[Customer ID]","[Customer].[Customer ID].&["&A2&"]","[Customer].[Staff]","[Customer].[Staff].&["&B2&"]")
 
Upvote 0
@FormR, thanks for the great help! It works.

btw, I can't find the Edit option that I can edit/update the question. Can you please advise me too? Thank you.
 
Upvote 0
I can't find the Edit option that I can edit/update the question
Hi, you only get 10 minutes or so grace period to edit your posts - it might also be a privilege that you only get once you've reached a certain number of posts (not sure about that bit though!) I believe the restrictions are mainly in place to deter spam.

It works.
Great, good to hear!
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top