quiz: pivottables, formulas, sum ... what are the calculation rules ?

lalbatros

Well-known Member
Joined
Sep 5, 2007
Messages
659
Hello,

I wonder what are the exact rules defined for calculating an aggregate function like "SUM" in a pivot table, when a complex formula calculated field is involved.

For example, let us assume we have a table with three fields: (item, quantity, value) .
In a pivot table you could insert the aggregate data Sum(quantity) or Sum(value) that have clear meanings: the total quantity or the total value.

Now the name "calculated field" is a bit misleading.
Assume we defined the quantity cost = value/quantity.
When aggregating, in a pivot table, excel will calculate:

Sum(cost) = Sum(quantity)/Sum(value)

As far as I remember, this rule has always been exactly what I really wanted. Really a luck!
However, it is a bit misleading to call "cost" a "calculated field". Since if "cost" is a field like other field, like "quantity" for example, then the rule would be

Sum(cost) = Sum(quantity/value)

which is generaly something different.

Now the quiz: what happens for more complicated expressions, what is the rule, and why would the rule be also generally lucky???

For example, let us assume we have these fields now: (item, a, b, c, d, e).
How would excel aggregate in a pivot table the following function f = (a*a+b*b)/(a*b+d*c)?
For example, would it be calculated as follows:

Sum(f) = (Sum(a)*Sum(a)+Sum(b)*Sum(b))/(Sum(a)*Sum(b)+Sum(d)*Sum(c))

and -if yes- would that be justified for most applications, and why?

I think this question goes back to what are basically pivottables or aggregate function.
I know in practice, but not in general.

My motivation is that I come to an application where I will automatically append "calculated fields" to my pivot tables in order to match what is done in a another application and defined by the user. I would like to know the rules in order to understand what could happen in more complex situation and explain to the users -as clearly as possible- what the rules are.

Thanks for you help.
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,215,129
Messages
6,123,218
Members
449,091
Latest member
jeremy_bp001

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