To find standard deviation, calculate the mean, subtract it from each value, square each difference, and add the squares. Divide that sum by n for a population or by n โ 1 for a sample to get the variance, then take the square root. The result measures how far values typically sit from the mean.
What is the standard deviation formula?
There are two versions, which differ only in the divisor.
Population standard deviation (ฯ):
ฯ = โ[ ฮฃ (x โ ฮผ)ยฒ รท N ]
Sample standard deviation (s):
s = โ[ ฮฃ (x โ xฬ)ยฒ รท (n โ 1) ]
Here x is each value, ฮผ or xฬ is the mean, and N or n is the number of values. The NIST/SEMATECH e-Handbook of Statistical Methods gives the sample form, with n โ 1, as the standard definition of standard deviation, and describes variance as roughly the average squared distance from the mean.
Population vs sample: n or n โ 1?
| Population | Sample | |
|---|---|---|
| Data covers | Every member of the group | A subset of a larger group |
| Divide by | n | n โ 1 |
| Symbol | ฯ | s |
| Excel function | STDEV.P | STDEV.S |
| Typical use | All employees of one firm; every test score in one class | A survey of 500 voters; 30 parts pulled from a production line |
Why divide by n โ 1 for a sample?
A sample's mean is calculated from the same data, so the values sit slightly closer to their own mean than to the true population mean. Dividing by n would therefore underestimate the population's spread on average. Dividing by n โ 1, known as Bessel's correction, makes the sample variance an unbiased estimate of the population variance. The correction matters most for small samples; with hundreds of values, n and n โ 1 give nearly the same answer.
How do you find standard deviation step by step?
The worked example uses eight values: 2, 4, 4, 4, 5, 5, 7, 9.
Step 1: Find the mean
Sum = 2 + 4 + 4 + 4 + 5 + 5 + 7 + 9 = 40. Mean = 40 รท 8 = 5.
Steps 2 and 3: Subtract the mean, then square each deviation
| Value (x) | Deviation (x โ 5) | Squared deviation |
|---|---|---|
| 2 | โ3 | 9 |
| 4 | โ1 | 1 |
| 4 | โ1 | 1 |
| 4 | โ1 | 1 |
| 5 | 0 | 0 |
| 5 | 0 | 0 |
| 7 | 2 | 4 |
| 9 | 4 | 16 |
| Sum | 0 | 32 |
The deviations always add to zero, which is why they are squared: squaring removes the signs so positive and negative distances do not cancel out.
Step 4: Divide to get the variance
- Population variance = 32 รท 8 = 4
- Sample variance = 32 รท 7 = 4.571
Step 5: Take the square root
- Population standard deviation = โ4 = 2
- Sample standard deviation = โ4.571 = 2.138
Treating the eight values as a complete population gives 2. Treating them as a sample drawn from something larger gives about 2.14.
What is variance, and how does it relate?
Variance is the step before the square root: the average squared deviation. In the example, the variance is 4 (population). Because it is in squared units (if the data is in centimetres, variance is in square centimetres), it is hard to read directly. Standard deviation converts back to the original units, which is why it is the figure usually reported.
How do you interpret standard deviation?
Standard deviation describes spread in the data's own units.
- Small standard deviation: values cluster near the mean.
- Large standard deviation: values are widely spread.
- Zero: every value is the same.
Two classes can both average 75 on a test. If one has a standard deviation of 4 and the other of 15, the first class scored consistently, while the second had a wide range of high and low scores.
The 68โ95โ99.7 rule
When data is approximately normal (bell-shaped and symmetric), the empirical rule applies:
| Range | Share of values (approx.) |
|---|---|
| Mean ยฑ 1 standard deviation | 68% |
| Mean ยฑ 2 standard deviations | 95% |
| Mean ยฑ 3 standard deviations | 99.7% |
Example: if adult heights in a group are roughly normal with a mean of 170 cm and a standard deviation of 7 cm, about 68% fall between 163 and 177 cm, and about 95% between 156 and 184 cm.
The rule should not be applied to strongly skewed data, such as incomes, where most values are low and a few are very high.
How do you find standard deviation in Excel?
| Function | Divides by | Use when |
|---|---|---|
=STDEV.S(A1:A8) |
n โ 1 | The data is a sample |
=STDEV.P(A1:A8) |
n | The data is the entire population |
=VAR.S(A1:A8) |
n โ 1 | Sample variance |
=VAR.P(A1:A8) |
n | Population variance |
Microsoft's documentation states that STDEV.S assumes its arguments are a sample and uses the "n โ 1" method, while STDEV.P assumes the entire population and uses the "n" method. For the example data in cells A1:A8, STDEV.S returns about 2.138 and STDEV.P returns 2. The older STDEV and STDEVP functions still work and match STDEV.S and STDEV.P respectively. Google Sheets uses the same names.
Common mistakes
- Using the wrong divisor. Most real-world data is a sample, so n โ 1 is the safer default unless the full population is known.
- Forgetting the square root. Reporting the variance as the standard deviation overstates spread whenever the variance is above 1.
- Rounding the mean too early. With decimal data, rounding the mean before computing deviations introduces errors; keep full precision until the end.
- Confusing standard deviation with standard error. Standard error is the standard deviation divided by โn and measures uncertainty in the mean, not spread in the data.
For a quick mean or average before working out spread, an average calculator handles the first step.