GETPIVOTDATA - datafield

sheepshagarmy

New Member
Joined
Jan 4, 2015
Messages
12
Hi all,

I'm looking to return data from a pivot table in another tab

(e.g.)

18/06/201725/06/2017
Apples
- Red3288
- Green4212
Oranges
- Satsumas554
- Blood Orange5047

<tbody>
</tbody>


If the table above was a simple version of a pivot table - and in another tab I'd like to read how many red apples I have on the 18th of June, that's fine as I have used:

=GETPIVOTDATA("18/06/2017",PIVOT!$B$3,"Fruit","APPLE","Type","RED")

(GETPIVOTDATA(data_field, pivot_table, [field1, item1, field2, item2], ...))

However, the worksheet in question is rolled once a week using a macro - a new sheet is created with the same formulas as the last version while the data rolls. So in the example above, 18/06/2017 would delete and Cell B1 becomes 25/06/2017. I would like the formula above to then return the new value for Cell B1 - and so now giving me the data for Red Apples on 18/06/2017.

Is there any way I can make the data_field match the column in question rather than go and look for the field 18/06/2017 in the pivot table?

Tried my best but cannot do it, help!!

Cheers

SSA
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Assuming you have a cell with that value in it, you can use that cell reference - e.g. instead of "18/06/2017", you use ""&B2. If the cell in question contains an actual date value rather than text, you may need to format it with the TEXT function like this:

""&TEXT(B2,"dd/mm/yyyy")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,999
Members
448,543
Latest member
MartinLarkin

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