Copying formulas that draw data from a pivot table

saraapple

Board Regular
Joined
Feb 3, 2020
Messages
165
Office Version
  1. 2010
Platform
  1. Windows
I need to use a simple formula to work percentage share - but as the data is being taken from a pivot table I am struggling to copy my formulas and there is too much data to do it individually.

This is the formula I want to copy:
MONDAY %
=GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$4,"Week",1,"Store ID",121,"Day of week","Monday","Region","East")/GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$4,"Week",1)

TUESDAY %
When I drag the formula across I want it to say:
=GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$4,"Week",1,"Store ID",121,"Day of week","Tuesday","Region","East")/GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$4,"Week",1)

I also need to copy the formulas down:

STORE 121
=GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$4,"Week",1,"Store ID",121,"Day of week","Monday","Region","East")/GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$4,"Week",1)

STORE 185
=GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$4,"Week",1,"Store ID",185,"Day of week","Monday","Region","East")/GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$4,"Week",1)

Is there a quick way to do this?

Alternatively - could I create a pivot table that would display percentages so I would not need a separate table?

Budgeting Tool 070820.xlsx
ABCDEFG
4Sum of RPEColumn Labels
511 Total
6WeekMondayTuesdayWednesdayThursdayFriday
7East
812117.59515.7159.8858.7176.17258.084
91856.33814.92613.5479.3835.80149.995
102258.265.7575.96215.8019.75445.534
1138516.05212.5899.0917.7176.21651.665
125354.7167.00518.88514.7133.92249.241
135505.46518.2616.3818.7596.17355.038
145804.9655.00415.04910.7134.58840.319
1562514.96913.5898.4667.6344.79449.452
1674012.00910.8399.5086.9656.21245.533
178053.9238.00314.6818.7196.08851.413
188758.1758.96813.22124.59813.88468.846
199005.0917.84116.51317.1775.79652.418
2091011.42822.93323.3467.6726.25771.636
2199515.00910.67310.0089.726.50551.915
22Grand Total133.995162.102184.542168.28892.162741.089
Deliveries Pivot


On the sample data I have provided above I need to take B8 and divide by G22 to get a percentage of 2.374%.

I am really hoping someone can help me out - as there is too much data for me to type each cell!

Thanks
Sara
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You could use a for/next loop to cycle through each cell. I do not have a computer right now, so I cannot write you the code. But if you’re familiar with VBA, that’ll get you on the right track. Otherwise, I can guide you on what to try.
 
Upvote 0
As for your percentages, =B8/$G$22
 
Upvote 0
Thank you for your reply :)
From your answer I take it that VBA code is the best way to approach this, I did think a pivot might be able to give me the results I needed but after spending hours trying to do this I gave up!
I have created work with VBA before - but my knowledge is very limited (I still use the "record macro") so any advice you could give me will be most appreciated.
Sara
 
Upvote 0
Thank you for your reply :)
From your answer I take it that VBA code is the best way to approach this, I did think a pivot might be able to give me the results I needed but after spending hours trying to do this I gave up!
I have created work with VBA before - but my knowledge is very limited (I still use the "record macro") so any advice you could give me will be most appreciated.
Sara
The first two formulas, where are they going? What cells? And the second two as well, please.
 
Upvote 0
The first formula is in B4
Budgeting Tool 070820.xlsx
ABCDEFGHI
112
2WeekMondayTuesdayWednesdayThursdayFridaySaturdaySundayMonday
3East
41211.150%0.851%0.117%0.103%0.073%0.000%0.000%0.209%
51850.414%0.177%0.160%0.111%0.069%0.000%0.000%0.101%
62250.098%0.068%0.071%0.187%0.115%0.000%0.000%0.061%
73850.190%0.149%0.108%0.091%0.074%0.000%0.000%0.198%
85350.056%0.083%0.224%0.174%0.046%0.000%0.000%0.095%
95500.065%0.216%0.194%0.104%0.073%0.000%0.000%0.086%
105800.059%0.059%0.178%0.127%0.054%0.000%0.000%0.059%
116250.177%0.161%0.100%0.090%0.057%0.000%0.000%0.194%
127400.142%0.128%0.113%0.082%0.074%0.000%0.000%0.192%
138050.046%0.095%0.174%0.222%0.072%0.000%0.000%0.070%
148750.097%0.106%0.157%0.291%0.164%0.000%0.000%0.066%
159000.060%0.093%0.195%0.203%0.069%0.000%0.000%0.070%
169100.135%0.271%0.276%0.091%0.074%0.000%0.000%0.093%
179950.178%0.126%0.118%0.115%0.077%0.000%0.000%0.184%
18Ireland
196450.023%0.044%0.192%0.062%0.178%0.000%0.000%0.019%
207500.016%0.050%0.125%0.066%0.138%0.000%0.000%0.047%
218500.022%0.087%0.148%0.091%0.190%0.000%0.000%0.027%
228800.021%0.057%0.110%0.073%0.172%0.000%0.000%0.022%
239050.038%0.043%0.119%0.075%0.212%0.000%0.000%0.023%
24Offshore
251140.096%0.215%0.125%0.074%0.074%0.000%0.000%0.054%
266150.072%0.078%0.059%0.149%0.098%0.000%0.000%0.048%
27London
28250.022%0.137%0.125%0.186%0.079%0.000%0.000%0.078%
29450.038%0.160%0.168%0.094%0.041%0.000%0.000%0.056%
301120.071%0.191%0.143%0.089%0.061%0.000%0.000%0.074%
311150.133%0.110%0.084%0.085%0.145%0.000%0.000%0.118%
321750.146%0.102%0.079%0.113%0.143%0.000%0.000%0.126%
333350.143%0.165%0.106%0.140%0.184%0.000%0.000%0.161%
344550.098%0.083%0.046%0.197%0.122%0.000%0.000%0.080%
356400.110%0.112%0.123%0.278%0.160%0.000%0.000%0.058%
366800.147%0.262%0.228%0.113%0.081%0.000%0.000%0.109%
377250.105%0.091%0.142%0.280%0.172%0.000%0.000%0.079%
387650.082%0.241%0.166%0.084%0.073%0.000%0.000%0.089%
398250.082%0.074%0.043%0.236%0.114%0.000%0.000%0.048%
40Midlands
41100.135%0.159%0.104%0.072%0.052%0.000%0.000%0.109%
42350.063%0.156%0.227%0.097%0.049%0.000%0.000%0.078%
43550.138%0.129%0.111%0.076%0.049%0.000%0.000%0.170%
44800.069%0.169%0.169%0.109%0.059%0.000%0.000%0.143%
Percentage Del
Cell Formulas
RangeFormula
B4B4=GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$1,"Week",1,"Store ID",121,"Day of week","Monday","Region","East")/GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$1,"Week",1)
C4C4=GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$1,"Week",1,"Store ID",121,"Day of week","Tuesday","Region","East")/GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$1,"Week",1)
B41:H44,B28:H39,B25:H26,B19:H23,B6:H17,C5:H5,D4:H4D4='Historical Figs Del'!D4/'Historical Figs Del'!$I$191
I41:I44,I28:I39,I25:I26,I19:I23,I4:I17I4='Historical Figs Del'!J4/'Historical Figs Del'!$Q$191
B5B5=GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$1,"Week",1,"Store ID",185,"Day of week","Monday","Region","East")/GETPIVOTDATA("RPE",'Deliveries Pivot'!$A$1,"Week",1)
 
Upvote 0
With my phone, this is really difficult. @Fluff has always been able to help me with code. He may even have a better solution. If he isn’t able to help you do to time, I will work on something that should work.
 
Upvote 0
Sorry to ask again - but have you any guidance for me on this? As much as I would like the problem is not going away and I need to get this done ASAP.
thanks know you must be busy appreciate any advise.
Sara
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,942
Members
449,094
Latest member
teemeren

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