How do I take an average of two individual data items within a field in a Pivot Table in Excel?
February 10, 2005 11:06 AM
Subscribe
Excel Purgatory - Help!
How do I take an average of two individual data items within in a field in a Pivot Table? (More Inside)
My raw data looks like a much expanded version of this:
Company Year Value
Company A 1 10
Company A 2 15
Company A 3 20
Company B 1 25
Company B 2 30
Company B 3 35
Company C 1 40
Company C 2 45
Company C 3 50
And the table I want to end up with is sort of like this:
Sum of Value Year
Company 1 2 3
Company A 10 15 20
Average 12.5 17.5
Company B 25 30 35 Average 27.5 32.5
Company C 40 45 50
Average 42.5 47.5
I don't have a choice in how my raw data comes to me, and I have to do this in a pivot table for a bunch of reasons. The actually pivot table itself is pretty huge, lots of calculated fields and such. I thought I knew what I was doing, but I am totally lost on this. Search the MSFT Knowledge base, a few XLS message boards. Nothing is getting me there.
I can create "calculated Items" that run down the table rather than across but that is pretty useless to me
Any help much appreciated.
(Apologies I can't quite get the formatting right on the table.)
posted by JPD to computers & internet (8 comments total)
1 user marked this as a favorite
=IF(B2=1,0,AVERAGE(C1,C2))
(assuming column B=Year, column C=Value)
And then drag it down, let it autocalc that running average between the years if the years aren't "1". Then, make a new pivot table with a layout including column D putting Company in the row field, Year in the column field, and the Sum of Value and Sum of Average values in the data field. That'll create something that doesn't look attractive but is technically what you're asking for with some extraneous summing; you can play around with the formatting from there.
Or am I missing something? Or are you not allowed to autocalc data on the main sheet you're deriving the table from?
posted by eschatfische at 11:50 AM on February 10, 2005