I'm plotting yield for products. I have two ways of classifying products, lets say these two ways are first as numbers: 1, 2, 3, 4, ect, and then as letters, a, b, c, d, e, ect. The letters are a subcategory of the numbers. So within products, I have many different letters within individual number groups:
1: a, b, c, e
2: c, d
3: a
For each product, I've calculated yield and plotted it in a pivot table. I've plotted the pivot table so that the "letters" are a subcategory of the "numbers" within the column labels, please see picture below (please note that in the picture the subcategory is labelled using numbers as well, the "letters" subcategory is just to try to explain with more contrast in this question)
This is all well and good, but I'd like to find an average of everything within the "numbers" umbrella category. However, there's one final problem to consider with the task: the amount of products that contribute to a yield average may be different per letter subcategory. I.e:
1 - a: 2 out of 2 products yielded = 1 (fractional yield)
1 - b: 2 out of 22 products yielded = 0.09 (fractional yield)
This leads to a problem while using pivot tables. Using the above yield fractions, if I was using the pivot tables's "average of yield" to work out the total yield for all the "1" group, it would calculate:
1 + 0.09 / 2 .... = 0.54 (fractional yield)
But we can see that this isn't a true representation of yield, as it should be:
(2 + 2) / (2 + 22) =
4 / 24 =
0.17 (fractional yield)
Can anyone work out a way of calculating true yield with pivot tables rather than the average of an average?
I got it!
I went here: https://support.office.com/en-nz/article/Calculate-values-in-a-PivotTable-report-697406b6-ee20-4a39-acea-8128b5e904b8
And adapted this section:
to fit my copy of Excel 2010 by doing the following:
This gives the correct answers you were looking for.