KajoData / statistics
Standard deviation: formula, sample and interpretation
I use three numbers to explain the calculation and why two valid variants return different results.

Two teams can have the same average handling time and very different working days. In one, cases finish at almost the same pace. In the other, some finish immediately while others take a long time. When I want to describe spread around the mean, I use standard deviation. I also state exactly what I measured and which calculation produced the number.
I will start with a small example, then work through the traps: dividing by n or n - 1, comparing tools, handling unusual observations and mixing groups. The numbers are synthetic. They do not represent market prices or a measurement from a particular company. The purpose is to understand the arithmetic and its limits before one statistic starts acquiring a life of its own in a report.
What standard deviation describes
Standard deviation measures dispersion around the arithmetic mean. A larger result means more spread according to this measure. Mathematically, it is the square root of variance, which uses squared differences between observations and their mean. It helps to understand the two concepts together, although standard deviation is usually easier for a report reader to interpret.
If the variable is measured in minutes, standard deviation is in minutes too. Variance is in squared minutes, which is harder to connect to an everyday process. Taking the square root restores the original unit. NIST explains this relationship in its overview of scale measures. In a presentation, I would generally show the mean and standard deviation, leaving the variance calculation in the metric definition.
I would avoid calling standard deviation literally the average distance from the mean. Averaging absolute deviations produces a different statistic. Here, I square differences before taking the square root of the resulting variance. That changes the influence of distant observations. Remembering only “values differ by this much on average” can lead to an interpretation that the actual arithmetic does not support.
The same centre with different spread
Compare the synthetic datasets 149, 150, 151 and 140, 150, 160. Both have a mean of 150. In the first, the outer values are one unit below or above the centre. In the second, those distances are ten units. Reporting the average alone completely hides the difference. In a report about consistency, that difference may be the main point.
I do not conclude that less spread automatically means better business performance. Lower variability in processing time may help planning, but the average level must still be acceptable. A process that always takes far too long can be predictable and still be a problem. I therefore consider level and dispersion together. Neither number replaces the question of what the recipient actually needs.
Work through the arithmetic
Take three synthetic prices in arbitrary units: 140, 150 and 160. Their sum is 450 and their mean is 150. Subtracting the mean from each price gives -10, 0 and 10. These ordinary deviations sum to zero, so averaging them would not provide a useful description of spread.
Next, square the deviations. They become 100, 0 and 100, with a sum of 200. Up to this point, the calculation is shared by two common variants. The divisor determines which variance I calculate. I keep this step visible because it is often the source of an apparent disagreement between Excel and Python.
| Value | Difference from the mean of 150 | Squared difference |
|---|---|---|
| 140 | -10 | 100 |
| 150 | 0 | 0 |
| 160 | 10 | 100 |
If these three prices are the entire population being described, I divide 200 by 3. Variance is 200/3, and standard deviation is the square root of 200/3, approximately 8.16 units. If I treat them as a sample and use the conventional n - 1 correction, I divide by 2 instead. Variance is then 100 and standard deviation is exactly 10.
Population or sample depends on the question
A population is the collection I want to describe. If I care only about all three products in this small offer, dividing by n describes their dispersion. If I use those prices as a sample from a broader process, the n - 1 variant becomes relevant. File size alone cannot decide the choice. A million rows can still constitute a sample.
The n - 1 correction relates to estimating population variance from a sample using an estimated mean. Under suitable assumptions it gives an unbiased estimator of variance. It does not follow that its square root is automatically an unbiased estimator of standard deviation. The statistics module documentation explains the variance distinction. I would not attach a stronger guarantee than the calculation provides.
Having every record from one month does not mean I have the entire population of future months. Describing a completed month and making inferences about the ongoing process are separate objectives. In practice, I would state whether the number is descriptive or used to estimate wider variability, and record the selected divisor. That makes the analytical decision visible to whoever maintains the report later.

Excel has separate functions
With the example prices in A2:A4, English Excel provides =STDEV.S(A2:A4) for the sample variant and =STDEV.P(A2:A4) for the population variant. Microsoft documents STDEV.S and STDEV.P separately. For our inputs, the expected results are 10 and approximately 8.16 respectively.
Localized installations may use translated function names. Older workbooks may also contain compatibility functions such as STDEV. When maintaining a report, I establish what the existing formula means before replacing it. Tidying function names should not silently change the calculation or its comparability with previous months. The labels “old” and “new” are insufficient grounds for choosing a population or sample definition.
For cell ranges, check numbers stored as text, empty cells and errors. Neither the S nor the P variant is an import repair tool. If some values are excluded because of their type, the result can look convincing while describing a different dataset from the intended one. Alongside standard deviation, I would compare the count of numeric observations with the expected number of records and investigate any discrepancy.
Make the Python and pandas convention explicit
In Python’s standard library, statistics.stdev calculates sample standard deviation and statistics.pstdev calculates population standard deviation. These are module functions, rather than list methods. Passing the same three prices corresponds to the two calculations discussed above. The documentation also specifies the required observation counts, so empty inputs and single values need handling appropriate to the selected function.
In pandas, Series.std defaults to ddof=1. The divisor is N - ddof. Setting ddof=0 changes it to N. For this example without missing values, pd.Series([140, 150, 160]).std(ddof=1) corresponds to a result of 10. I would write the parameter explicitly in a report even when it matches the default, so the decision remains readable months later.
When comparing libraries, I also inspect missing-value handling. Matching divisors will not guarantee matching results if one function excludes missing observations and another propagates a missing result. The pandas documentation specifies skipna=True by default. I do not automatically replace missing values with zero, because zero is an observation that changes both the mean and dispersion. First establish what missingness means in the source.
A large result does not identify a faulty record
Squaring increases the influence of distant observations. In our table, a difference of ten contributes 100 to the sum, while a difference of one would contribute only 1. Standard deviation is therefore sensitive to the tails. It may increase because of valid rare cases or because of a measurement error. The statistic alone cannot choose between those explanations.
If it jumps unexpectedly, I inspect the underlying observations and how they were produced. I check units, duplicates, system changes and the types of cases handled. I would not remove extreme records merely to restore a chart’s previous appearance. If an exclusion is justified, I retain the reason and show its effect on the description. Otherwise it is easy to improve the number while weakening the report’s connection to the process.
Two standard deviations are not a universal test
Saying that everything beyond the mean plus or minus two standard deviations is wrong goes too far. Under a normal distribution, that interval contains about 95.45% of the distribution. Even in the ideal model, some valid observations lie outside it. Other distributions place different proportions within the interval. The threshold does not have an automatic statistical interpretation without its assumptions.
NIST emphasizes that outlier identification depends on the distributional model. I would begin with a plot and knowledge of the process. Long completion times may form a natural right tail. A rule based on symmetry can then flag many valid cases. Screening a record, performing a formal test and deciding to delete it are three separate actions.
Observation spread and uncertainty about the mean
Standard deviation describes variation among individual observations. The standard error of the mean concerns variation of the mean estimator across repeated samples. For independent observations with a common distribution and finite variance, the conventional estimated standard error is s divided by the square root of the sample size. The NIST confidence interval guidance uses that quantity. I would not apply the formula mechanically to a dependent time series.
The difference matters on a chart. Narrow standard-error bars do not mean individual durations are similar. They may reflect a large sample and a relatively precisely estimated mean. The label “error” is insufficient. State whether the chart shows standard deviation, standard error or a confidence interval. Otherwise the reader may make a decision about a completely different kind of uncertainty from the one the display actually represents.
Units, scale and comparison
Converting minutes to seconds multiplies both the mean and standard deviation by 60. Variance is multiplied by 3,600 because it uses squared units. This change does not indicate a deterioration in the process: only the unit changed. Comparing 2 minutes with 120 seconds requires clear labels before anybody interprets the numerical difference as a performance change.
Adding the same constant to every observation shifts the mean but leaves standard deviation unchanged. For 140, 150, 160 and 240, 250, 260, the deviations from their respective means are identical. This is a useful check on intuition. Standard deviation describes distances from the centre, so moving the whole dataset does not widen or narrow it according to this measure.
I would not directly compare standard deviations of variables with different units. Relative comparisons sometimes use the coefficient of variation, but that requires a meaningful ratio scale and care when the mean is near zero. It is not an automatic solution for every numerical column. I would begin with the same variable, the same unit and a comparable record level.
Group means do not describe individual records
If I first calculate each day’s average duration and then calculate the standard deviation of those averages, I describe variation between daily averages. That is different from the standard deviation of individual cases. A day with two cases and a day with two hundred can receive equal weight in that calculation. This may be intentional, but the result’s level must be stated.
Combining teams presents a related problem. Overall dispersion depends on variation within groups and differences between their means. Averaging the reported standard deviations does not generally recover the organization’s overall standard deviation. You need raw data or suitable summary statistics combining counts, means and variances. For an ordinary report, I would initially display the groups separately and check whether the comparison is meaningful.
Small samples and constant observations
For a single observation, descriptive population standard deviation is zero, but sample standard deviation with divisor n - 1 is undefined. Programs may signal this differently, for example with an error or a missing value. I would not interpret zero as evidence of a consistent process when only one measurement exists. Its variability has simply not been observed yet.
If all values are identical, standard deviation is zero provided the chosen calculation has enough observations. Later operations that divide by standard deviation, such as standardization, need separate handling. I would not add a small constant without justification. Zero may reflect genuine constancy, strong rounding or an import problem. These situations require different responses despite producing the same statistic.
Repeated measurements may be dependent
One hundred readings taken every second during a single brief outage need not provide the same information as one hundred independently sampled cases. Descriptive standard deviation can still be calculated, but uncertainty about the mean requires attention to dependence. If consecutive values move together, adding rows does not guarantee a proportional gain in precision. I would inspect time order and define what constitutes a separate case.
Technical duplicates matter too. Importing the same export twice doubles the row count without adding measurements. Exact duplication leaves the descriptive n-divisor spread unchanged; it does not justify claiming greater inferential certainty. The n - 1 variant may even change slightly because its count correction changes. That is why I check keys and record provenance before discussing the statistic.
Do not average standard deviations for convenience
A small example exposes the aggregation trap. One group has values 10 and 10; another has 20 and 20. Both groups have zero standard deviation because neither contains internal variation. In the complete dataset 10, 10, 20, 20, the mean is 15 and population standard deviation is 5. Averaging the two group zeros would completely lose the difference between groups.
If readers need both perspectives, I show the group summaries and the overall result. I would not label an arithmetic average of group standard deviations as the standard deviation of all observations. A separate indicator can be defined, but its meaning must be explained. Otherwise a tidy table answers a different question from the one implied by its heading.
Explain the result and practise the calculation
For a report I would state the mean, standard deviation, observation count, unit, period and calculation variant. I would add a distribution view when tails or mixed groups matter. For central spread that is less driven by extreme values, I also inspect quartiles and IQR. For interpreting percentages within standard-deviation intervals, return to the normal distribution.
On paper, calculate sample standard deviation for 149, 150, 151. The mean is 150, squared deviations sum to 2, and the divisor is 2, so standard deviation is 1. Compare that with 10 for 140, 150, 160. Finally, explain why the means match and why changing the divisor changes the result. Once those steps are clear, the spreadsheet function becomes much easier to interpret.
Key takeaways
How does variance differ from standard deviation?
Standard deviation is the square root of variance. It has the original data unit, while variance uses the squared unit.
Should I divide by n or n-1?
Dividing by n describes a dataset treated as the complete population. The conventional sample variant uses n-1 and requires at least two observations.
Is a point beyond two standard deviations an error?
The threshold alone does not establish an error. Interpretation depends on the distribution and process; valid normal observations can also fall beyond it.
AI was used in an automated way while working on this article. If you want to learn how to do it too, check out this project.
