HomeFinanceStandard Deviation Formula: How to Calculate It Step by Step

Standard Deviation Formula: How to Calculate It Step by Step

The standard deviation formula measures how spread out a set of numbers is around its average. A small result means values sit close to the mean. A large one means they are scattered. This guide shows the population and sample versions, a full worked example, and common mistakes to avoid.

What Is the Standard Deviation Formula?

Standard deviation formula idea shown as wooden blocks spread around a central block on a desk

Standard deviation starts with the variance. The NIST/SEMATECH e-Handbook of Statistical Methods says, in its page on measures of scale, that “the variance is roughly the arithmetic average of the squared distance from the mean.” It then adds that “the standard deviation is the square root of the variance.”

There are two versions of the standard deviation formula. Which one you use depends on whether your data covers every value in the group or only part of it.

Population standard deviation

Use this when you have every value in the group.

σ = √( Σ(x − μ)² ÷ N )

  • σ (sigma): the population standard deviation.
  • x: each value in the data set.
  • μ (mu): the population mean.
  • N: the number of values.
  • Σ: add up the results for every value.

Sample standard deviation

Use this when your data is a sample from a larger group and you want to estimate that group’s spread.

s = √( Σ(x − x̄)² ÷ (n − 1) )

Here s is the sample standard deviation, x̄ (x-bar) is the sample mean and n is the number of values in the sample. The only change is the bottom of the fraction: n − 1 instead of N.

Why does the sample formula divide by n − 1?

The sample mean is the point that makes the sum of squared deviations as small as possible for that data. So squared distances from it tend to run smaller than squared distances from the true population mean. Dividing by n − 1 instead of n corrects for this.

Penn State’s STAT 500 lesson on summarizing data explains that when the sample mean stands in for the population mean, dividing the sample variance by n − 1 “gives it a special property that we call an unbiased estimator” of the population variance.

How to Use the Standard Deviation Formula Step by Step

Six coin stacks of different heights, like six months of spending values

Take six months of household spending on groceries, in US dollars: $320, $380, $400, $360, $440 and $500. The same math works in any currency.

  1. Find the mean. Add the values ($2,400) and divide by the count (6). The mean is $400.
  2. Find each deviation. Subtract the mean from each value.
  3. Square each deviation. This removes negative signs.
  4. Add the squares. This is the sum of squares.
  5. Divide. Divide by n − 1 for a sample or N for a population. The result is the variance.
  6. Take the square root. The result is the standard deviation.
Month Spending (x) Deviation (x − 400) Squared deviation
1 $320 −80 6,400
2 $380 −20 400
3 $400 0 0
4 $360 −40 1,600
5 $440 40 1,600
6 $500 100 10,000
Total $2,400 0 20,000

Now finish both versions of the formula:

  • Sample: variance = 20,000 ÷ 5 = 4,000. Standard deviation = √4,000 = about $63.25.
  • Population: variance = 20,000 ÷ 6 = about 3,333.33. Standard deviation = √3,333.33 = about $57.74.

If these months are a sample of typical spending, report about $63.25. If they are the only months you care about, use about $57.74. PlusMind also has a stats calculator you can try with the same numbers.

What the Number Means

Standard deviation is in the same units as your data. NIST notes that it “restores the units of the spread to the original data units (the variance squares the units).” So a variance of 4,000 is in squared dollars, which is hard to picture. A standard deviation of about $63.25 is in plain dollars.

In the example, one standard deviation either side of the $400 mean runs from about $336.75 to about $463.25. Four of the six months fall in that band. The other two, $320 and $500, sit further out.

The 68-95-99.7 rule

For normal (bell-shaped) data, the standard deviation shows roughly where most values fall. The NIST page What do we mean by “Normal” data? gives these shares of a population:

  • 68.27% fall within 1 standard deviation of the mean.
  • 95.45% fall within 2 standard deviations.
  • 99.73% fall within 3 standard deviations.

Suppose a large set of monthly bills is roughly normal, with a mean of $400 and a standard deviation of $60. About 68% would fall between $340 and $460, about 95% between $280 and $520, and nearly all between $220 and $580. To turn a count of values in a band into a share, a percentage calculator helps.

This rule applies only to data that is close to normal. Six data points, like the grocery example, are too few to judge that.

Finance Example: Comparing Two Sets of Returns

The standard deviation formula can also describe how much yearly returns vary. Each yearly return is a percentage change from one year end to the next. Here are two made-up sets of five yearly returns.

Set Yearly returns Average Sample standard deviation
A 6%, 7%, 8%, 9%, 10% 8% about 1.58 points
B −4%, 20%, 2%, 18%, 4% 8% about 10.49 points

Both sets average 8% a year. Set B’s standard deviation is about 6.6 times larger, because its returns swing from −4% to 20%. Standard deviation describes past variation only. It does not predict future returns or say which set is preferable. For how a steady rate builds over time, see the compound interest formula.

Standard Deviation Formula in a Spreadsheet

Most spreadsheet programs include both versions as built-in functions:

  • =STDEV.S(A1:A6) uses n − 1, for a sample. For the grocery data it returns about 63.25.
  • =STDEV.P(A1:A6) uses N, for a full population. For the same data it returns about 57.74.

The gap between the two shrinks as the data set grows, because n − 1 and N differ by a smaller share as N grows. With six values, the sample result is about 1.095 times the population result. Choose the function by the same question as the hand method: sample or whole group?

Common Mistakes to Avoid

  • Using the wrong denominator. Dividing by N when the data is a sample makes the variance too small. In the example it gives 3,333.33 instead of 4,000, about 83% of the sample figure.
  • Adding deviations without squaring. Deviations from the mean always add up to zero, as the table shows. Squaring is what makes the total useful.
  • Forgetting the square root. Reporting 4,000 instead of about 63.25 gives the variance, not the standard deviation.
  • Applying the 68-95-99.7 rule to skewed data. The percentages hold for normal data. Lopsided data or data with extreme values can behave very differently.

Conclusion

The standard deviation formula comes down to six steps: find the mean, take each deviation, square it, add the squares, divide, and take the square root. Divide by N for a whole group and by n − 1 for a sample. The result is in the same units as the data, so it shows how far values typically sit from the mean. Use the 68-95-99.7 rule only for data that is close to normal.

RELATED ARTICLES
- Advertisment -

Most Popular