Microsoft Knowledge Base |
|
Excel: STDEV() Function Results Vary with Order of Numbers |
|
|
Last reviewed: June 30, 1997
Article ID: Q104951 |
|
The information in this article applies to:
SYMPTOMSIn Microsoft Excel, the results you get when you use the STDEV() function will vary depending on the order in which you enter the values. This behavior is incorrect: the results of this function should not depend on the order in which you enter the values.
CAUSEThe process used to calculate the STDEV() involves the subtraction of two values that may be very similar to each other. This can result in a small rounding error due to the way a computer stores and manipulates numbers. NOTE: The same inconsistent results occur if you use the formula on page 419 of the "Function Reference," version 4.0, to calculate this result manually.
WORKAROUNDTo work around this problem, round the data when you calculate the standard deviation. To round the data, you can use a macro similar to the one in the following procedure. Microsoft provides macro examples for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This macro is provided as is and Microsoft in no way guaranties that the following code can be used in all situations and will not support modifications of the code to suit specific customer requirements.
Macro That Rounds Data and Calculates the Standard Deviation
Explanation of Macro Code
A1: The name of the macro. A2: Defines data type of returned value. A3: Defines data type of input values. A4: Calculates n. A5: Formula to calculate the standard deviation. A6: Removes small discrepancy by rounding. A7: Formula to calculate the standard deviation. A8: Returns correct result to worksheet. MORE INFORMATION
Steps to Reproduce Behavior
To use the macro that you created in the "Macro That Rounds Data and Calculates the Standard Deviation" section of this article, do the following:
REFERENCES"Function Reference," version 4.0, page 419 "Function Reference," version 3.0, page 228 "Function and Macros," version 2.1, pages 109-110, 360
|
|
Additional reference words: 4.00 4.00a M_eXceL
©1997 Microsoft Corporation. All rights reserved. Legal Notices. |