# How to Calculate Standard Deviation in Excel

To calculate standard deviation in Excel, use `=STDEV.S(range)` when your data is a sample and `=STDEV.P(range)` when it is the entire population. Both functions take a cell range such as `B2:B11` and return the standard deviation in one step. This guide shows how to calculate standard deviation in Excel with both functions, explains which one to pick, and covers the errors you are most likely to hit.

## Quick Answer

- Sample data (most common): `=STDEV.S(B2:B11)` [1]
- Population data (every value you care about): `=STDEV.P(B2:B11)` [2]
- The range can be a column, a row, or a block of cells.
- STDEV.S uses the n-1 method, so it divides by one less than the count of values [1]
- Older workbooks may show `STDEV` and `STDEVP`. These still work but are kept only for backward compatibility, so prefer the newer functions [1]

## Before You Start

Two things decide which formula you type.

First, is your data a sample or a population? A sample is a subset drawn from a larger group, such as 10 students out of a whole school. A population is every value in the group you are describing. STDEV.S assumes its arguments are a sample of the population, while STDEV.P treats them as the full population [1]. If you are unsure, sample is usually the safer choice because research data is rarely a complete population.

Second, where does your data live? Standard deviation needs numeric values in a contiguous range. Put the numbers in one column or one row, leave no blank cells inside the range, and keep labels out of the range you feed the formula.

One behavior worth knowing: when an argument is a range or array, Excel counts only the numbers in it. Empty cells, logical values and text inside the range are ignored [1], but an error value such as `#N/A` in the range makes the whole formula return that error. That sounds helpful, but it can quietly shrink your sample size. If a blank cell should have held a measurement, the standard deviation is computed on fewer values than you think.

## Step by Step

1. Enter your data in a single column. For example, put the values in cells B2 through B11.
2. Click the cell where you want the result, such as C2.
3. Type the formula for your data type. For a sample, type `=STDEV.S(B2:B11)`. For a population, type `=STDEV.P(B2:B11)`.
4. Press Enter. The standard deviation appears in the cell.
5. Check the result against the count of values. If you expected 10 numbers and the answer looks off, confirm the range covers all of them and that no cell holds text instead of a number.

You can also build the formula through the interface. Select the cell, choose Insert Function from the Formulas tab, pick STDEV.S for a sample or STDEV.P for a population from the Statistical category, then enter the cell range in the Number 1 box [2]. You can type the range or click and drag across the values [2].

If you want to see the mean alongside the standard deviation, the same dialog approach works for AVERAGE. The [mean in Excel guide](/blog/data-analysis/how-to-calculate-mean-in-excel) walks through that function.

## Worked Example

A small study records reaction times in milliseconds for 10 students. Column A holds names and column B holds the times.

|   | A | B | C | D |
|---|---|---|---|---|
| 1 | Student | Reaction Time (ms) | Sample SD | Population SD |
| 2 | Ana | 342 | `=STDEV.S(B2:B11)` -> displays 42.19 | `=STDEV.P(B2:B11)` -> displays 40.02 |
| 3 | Ben | 298 |  |  |
| 4 | Cara | 410 |  |  |
| 5 | Dan | 275 |  |  |
| 6 | Eli | 388 |  |  |
| 7 | Fay | 321 |  |  |
| 8 | Gus | 356 |  |  |
| 9 | Hana | 302 |  |  |
| 10 | Ivy | 367 |  |  |
| 11 | Jon | 334 |  |  |

Cell C2 returns 42.19 and cell D2 returns 40.02. The two answers differ because the sample formula divides by n-1 and the population formula divides by n. With only 10 values, that single degree of freedom moves the result by about 2 milliseconds.

The sample formula is:

$$s = \sqrt{\frac{\sum (x_i - \bar{x})^2}{n-1}}$$

The population formula replaces the denominator with $N$:

$$\sigma = \sqrt{\frac{\sum (x_i - \mu)^2}{N}}$$

If you want to see the intermediate quantity, the [variance guide](/blog/data-analysis/how-to-calculate-variance-in-excel) shows how the squared deviations are averaged before the square root is taken. For a fuller treatment of the formula itself, see [how to calculate standard deviation](/blog/data-analysis/how-to-calculate-standard-deviation).

## Other Ways to Do It

The formula bar is not the only route.

**Insert Function dialog.** Select the target cell, open Insert Function from the Formulas tab, choose STDEV.S or STDEV.P from the Statistical category, then enter the range in the Number 1 box [2]. This is useful when you cannot remember the exact function name.

**Function list on the Formulas tab.** Start typing `=STDEV` in a cell and Excel suggests matching functions. Pick the one you want and select the range with the mouse.

**Manual calculation.** You can compute the standard deviation from scratch by building a helper column of squared deviations, summing it, dividing by n-1 or n, and taking the square root. This is slower but useful for teaching or for checking that a function result makes sense.

**A dedicated calculator.** If you only need the number and not a spreadsheet, the [Standard Deviation Calculator](/tools/standard-deviation-calculator) returns the sample and population values from a pasted list.

## Troubleshooting

**The result is `#DIV/0!`.** This happens when the range contains fewer than two numeric values for STDEV.S, or no numeric values for STDEV.P. Check that the range actually holds numbers.

**The result is `#VALUE!` or `#N/A`.** A text value typed directly as an argument that cannot be read as a number gives `#VALUE!` [1], and an error value such as `#N/A` inside the range is passed through as the result. Look for error cells inside the range.

**The answer looks too small.** Text and blanks inside the range are ignored, so the calculation may be running on fewer values than you intended [1]. Count the numeric cells and compare.

**The answer looks too large.** You may have included a total row, an ID column, or a year column in the range. Those are numbers to Excel even when they are not measurements.

**The formula shows as text.** The cell is probably formatted as Text. Change the format to General and re-enter the formula.

## Common Mistakes

- **Using STDEV.P on sample data.** This understates the spread because it divides by n instead of n-1. Use STDEV.S when your values are a sample [1].
- **Including the header row in the range.** A text header is ignored, but a numeric header such as a year is not. Start the range at the first data cell.
- **Leaving blank cells inside the range.** Blanks are skipped, which changes the effective sample size. Fill them or fix the range.
- **Mixing units in one column.** Milliseconds and seconds in the same range produce a standard deviation that describes neither. Convert first.
- **Reporting more decimal places than the data supports.** Reaction times measured to the nearest millisecond do not justify four decimals. Round to a sensible precision.
- **Confusing standard deviation with standard error.** They measure different things. The [standard error guide](/blog/data-analysis/standard-error-of-the-mean-in-excel) explains the difference, and [this comparison](/blog/research-skills/standard-deviation-vs-variance-vs-standard-error) covers when to report each.

## Limitations

Standard deviation describes spread around the mean, and it assumes the mean is a meaningful center. For heavily skewed data or data with extreme outliers, a single standard deviation can mislead because one large value inflates it. In those cases the median and interquartile range often describe the data better, and the [median guide](/blog/data-analysis/how-to-calculate-median-in-excel) shows how to get that value.

The functions also say nothing about why the values vary. A large standard deviation can come from real differences between subjects, from measurement error, or from a few data entry mistakes. Excel will compute the number either way. It also cannot tell you whether the difference between two groups is statistically meaningful, which requires a separate test.

## Frequently Asked Questions

### Should I use STDEV.S or STDEV.P?

Use STDEV.S when your values are a sample drawn from a larger group, which covers most research and business data. Use STDEV.P only when the range contains every value in the population you are describing [1]. The two answers are close when the sample is large and diverge when it is small.

### What is the difference between STDEV and STDEV.S?

They compute the same thing. STDEV is the older function, kept for backward compatibility, and Microsoft recommends using the newer functions because the old one may not be available in future versions [1]. STDEV.S is the current name for the sample version.

### Why does Excel give a different answer from my hand calculation?

The usual cause is the denominator. Excel's sample function divides by n-1, so if you divided by n by hand, your result will be slightly smaller. A second cause is a range that includes or excludes a value you did not intend.

### Can I calculate standard deviation for several columns at once?

Yes. Enter the formula in one cell and drag the fill handle across or down. If your ranges are laid out consistently, the references adjust automatically. For a whole table of columns, array-capable versions of Excel can return multiple results from one formula.

### How do I calculate standard deviation in Excel for grouped data?

You cannot feed frequency counts directly to STDEV.S or STDEV.P. Expand the grouped data into a list where each value appears as many times as its frequency, then apply the function to that list. For very large grouped datasets, compute the weighted variance manually and take the square root.

## References

1. [STDEV function | Microsoft Support](https://support.microsoft.com/en-us/excel/functions/stdev-function)
2. [Calculating the Mean and Standard Deviation with Excel | Educational Research Basics by Del Siegle | Neag School of Education | University of Connecti](https://researchbasics.education.uconn.edu/calculatingmeanstandarddev/)

## Further Reading

- [Broman KW, Woo KH (2018). Data Organization in Spreadsheets. The American Statistician](https://doi.org/10.1080/00031305.2017.1375989)
- [Ziemann M, Eren Y, El-Osta A (2016). Gene name errors are widespread in the scientific literature. Genome Biology](https://doi.org/10.1186/s13059-016-1044-7)
- [Microsoft Support: Excel help and learning](https://support.microsoft.com/en-us/excel)
- [McCullough B, Heiser DA (2008). On the accuracy of statistical procedures in Microsoft Excel 2007. Computational Statistics &amp; Data Analysis](https://doi.org/10.1016/j.csda.2008.03.004)

## Related Articles

- [How to Calculate Variance in Excel (Step by Step)](/blog/data-analysis/how-to-calculate-variance-in-excel)
- [How to Calculate the Mean in Excel (Step by Step)](/blog/data-analysis/how-to-calculate-mean-in-excel)
- [How to Calculate Standard Deviation: Formula and Steps](/blog/data-analysis/how-to-calculate-standard-deviation)
- [How to Calculate Median in Excel (Step by Step)](/blog/data-analysis/how-to-calculate-median-in-excel)
- [How to Calculate Standard Error of the Mean in Excel](/blog/data-analysis/standard-error-of-the-mean-in-excel)
- [Sample size standard deviation formula](/knowledge/diagnostics/research-methods/estimating-variability-how-to-use-standard-deviation-and-variance-in-sample-size-formulas)
- [Standard Deviation vs Variance vs Standard Error: What Each Measures and When to Report It](/blog/research-skills/standard-deviation-vs-variance-vs-standard-error)
- [Test Statistic Formula: How to Calculate and Use It](/blog/guides/test-statistic-formula-how-to-calculate-and-use-it)