Forum Discussion
Pivot Table StDev calculates different value then the STDEV formula
Hi,
I'm using Excel 2013 15.0.5153.1000 32-Bit and a pivot table to calculate StDev and compare quickly to the StDev calculated by the excel formulas. I noticed that sometimes the Pivot Table StDev function gives a different value compared to the StDev calculated by the excel formula.
When i found this i compared the StDev of the pivot table with every existing stdev formula from excel to see if i can get a match with one of the 6 formulas. In the attached file you can see this comparison with both StdDev and StdDevp function of the pivot table.
12 times out of 50 the StDev doesn't match. The error is very small, only the last few decimals are different.
Column J contains the values StdDev and StdDevp calculated by the pivot table, in columns K:P you can see the values calculated by the excel formulas. On rows 8, 10, 15, 16, 24 and 26 you can see that the StDev value from the pivot table doesn't match with any value calculated by the excel formulas. (Same thing for the StdDevp only the row numbers are different).
I'm curious if anybody knows the reason for this. Did anybody met this issue before? I can't find anything on the internet regarding this.
5 Replies
- JKPieterseSilver ContributorI assume this is caused by the algorithm of both STEDV calculations being slightly different hence causing a very small difference likely caused by rounding.
- zsoltturkosiCopper Contributor
I'm assuming the same thing, I've checked many settings and didn't found anything that could affect the StDev calculated by the pivot table. In the attached excel file i also set up the experiment so that i have the same amount of samples (30 samples) for each "TestCodeDescription". I though that maybe this is the cause, but it's not
- PeterBartholomew1Silver Contributor
The magnitude of the errors is roughly what I would expect, bearing in mind the subtraction that will lose you 1 decimal place and the summation over 30 values that will go a long way to losing a second. I tried two variations of the formula for a sample standard deviation from first principles and got results that varied slightly
= SQRT( SUM( (x - x̅)^2 ) / (n-1) ) = 0.2555612135223550
= SQRT( ( SUM(x^2) - n * x̅^2 ) / (n-1) ) = 0.2555612135223660
Form my sample of 1 test case, the first formula matches Excel and the second matches PQ, where x was defined to be $B$662:$B$691 and x̅
= SUM(x) / n