Adding a column of STD and AVG to a pivot table data

qnikchen

New Member
Joined
Apr 17, 2013
Messages
7
Hi Every one, I have been working on a pivot table. It has the following structure:

- ROW Labels: The material name
- COLUMN Labels: Month
- Report Filter: Year
- Values: Sum of Quantity


What this is is doing is creating at pivot table, where I can see the usage of each material (the number of materials can vary) per month (the number of months can varies, could be 3, 6 or 9 or 12). So, my month display the amount of quantity that was used for that particular month. After the month column labels, I have the grand total field which is part of the pivot table.

I would like to create two extra columns or field next to the grand total. I want the average usage per month and the std dev of that material. I cannot use the formula and create a field using the pivot desing features because it would only give me the average usage for each month, instead per month. Let me clarify with the following table (the pivot table with the fileds that I have described before)

So with the data generate with the pivot table I want to add the column Average per month, and Std Dev of the material which is

Average (bASKET BALL)= Average(2 +3 + 0) or ((2+3+0)/3) and
STD DEV (Basket ball) = STDDEV(2+ 3+ 0)

This is for each material.

Please any help or suggestion would be appreciate. Thanks!!
Material NameJunJulAugGrand Total Avg per Month Std
Basket ball2305
Volley ball1001
Soccer ball45716
Soft ball0011
Golf ball2347
Base ball1067

<tbody>
</tbody>



The hard part of this is that, the length of material would always varies everytime that I try to run the macro, also the number of month varies. This pivot table could be run for every quarter, or every two quarters, and this is the reason of why months could vary, as well for the material, since material are not sell in the period that I have selected. I think that I need to create a VBA that would create the column of Average in the available column and so forth.

I have no idea how to start to write the code. I am very new to VBA. I have been writing code for creating my pivot table. As I said before, any help or suggestion would be appreciate.

Thank you guys!!!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,203,046
Messages
6,053,190
Members
444,644
Latest member
keepontruckinc4

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