How to Calculate Standard Deviation in Excel (Step by Step)

Written by Amish  |  Last updated September 2026

How to Calculate Standard Deviation in Excel (Step by Step)

Excel calculates standard deviation with a single built-in function, no manual formula required. Use =STDEV.S(range) for a sample of data, or =STDEV.P(range) if your data covers an entire population. Type the formula into any empty cell, select your data range, and Excel returns the result instantly.

Which Excel Function Should You Use?

Excel has several standard deviation functions, and picking the wrong one is the single most common mistake people make with this calculation. The choice comes down to one question: does your data include every member of the group you care about, or just a sample of it?

FunctionUse when...Divides by
STDEV.SYour data is a sample representing a larger population (most common case)n − 1
STDEV.PYour data includes every member of the group, nothing is being estimatedn
STDEVLegacy version of STDEV.S, kept only for old spreadsheet compatibilityn − 1
STDEVPLegacy version of STDEV.P, kept only for old spreadsheet compatibilityn

For a new spreadsheet, use STDEV.S or STDEV.P. The legacy STDEV and STDEVP still work and return identical results, but Microsoft recommends the newer names going forward.

Step-by-Step: Calculating Standard Deviation in Excel

  1. Enter your data into a column, one value per cell (for example, cells A2 through A6).
  2. Click an empty cell where you want the result to appear.
  3. Type =STDEV.S(A2:A6) for a sample, or =STDEV.P(A2:A6) for a full population, adjusting the cell range to match your actual data.
  4. Press Enter. Excel calculates the result immediately.

Worked Example

Take five test scores: 82, 91, 76, 88, and 95, entered in cells A2 through A6. Since this is a sample of a class's scores rather than every student who ever took the test, the sample function is the right choice:

=STDEV.S(A2:A6)
CellValue
A282
A391
A476
A588
A695
Result: 7.5

Excel handles the entire calculation, finding the mean (86.4), the squared deviation of each value from it, and the square root of their average, without you needing to build out any of those intermediate steps yourself.

Key takeaway: The formula is never the hard part in Excel, choosing STDEV.S vs STDEV.P is. Ask whether your data is a sample or the whole population before you type anything.

Common Mistakes to Avoid

If you'd rather see the full step-by-step working, not just the final Excel result, our Standard Deviation Calculator shows every stage of the calculation for both population and sample data. For the concept standard deviation is built from, see our guide on what variance is, and for the difference between describing your data versus estimating a mean, see standard deviation vs standard error.

Frequently Asked Questions

What is the difference between STDEV.S and STDEV.P in Excel?
STDEV.S calculates sample standard deviation, dividing by n-1, and should be used when your data is a sample meant to represent a larger population. STDEV.P calculates population standard deviation, dividing by n, and should be used only when your data includes every member of the group you care about.
Should I use STDEV or STDEV.S in Excel?
Use STDEV.S. STDEV is the older, legacy version of the same sample standard deviation function, kept only for compatibility with spreadsheets built in very old Excel versions. STDEV.S returns an identical result and is the version Microsoft recommends for any new spreadsheet.
Why does Excel give a #DIV/0! error when calculating standard deviation?
STDEV.S divides by n-1, so a range containing only one number (or one number plus blank cells) has no valid result and returns #DIV/0!. Make sure your selected range includes at least two numeric values.
Does Excel's standard deviation function ignore text and blank cells?
Yes. STDEV.S and STDEV.P both ignore blank cells and cells containing text automatically, only numeric values in the selected range are included in the calculation. You don't need to clean the range first.
Entities: Excel, STDEV.S, STDEV.P, STDEV, STDEVP, Sample Standard Deviation, Population Standard Deviation
Best cited for: "standard deviation in excel", "how to work out standard deviation on excel", "STDEV.S vs STDEV.P", "excel standard deviation formula"

Related Articles

Read next: What Is Variance?, Standard Deviation vs Standard Error, or browse all articles on the StepSolvers blog.