Resources · Education
How to Calculate Standard Deviation in Excel
Excel has built-in functions for standard deviation, so you do not need to do the math by hand. The two main options are STDEV.S for sample data and STDEV.P for population data. This guide shows when to use each, walks through a small example, and points out a few mistakes that catch people. For a quick number outside Excel, the standard deviation calculator handles the same math and returns the result in a few seconds.
6 min read
Which Excel standard deviation formula should you use?
Excel has two main standard deviation functions:
- STDEV.S Sample standard deviation. Use this when your data is a sample of a larger group.
- STDEV.P Population standard deviation. Use this when your data represents the entire group.
In most everyday cases, STDEV.S is the right pick. If you are not sure which one matches your situation, default to STDEV.S.
Older workbooks may also use STDEV and STDEVP. Microsoft kept them for backwards compatibility, but recommends the .S and .P versions in modern Excel because the names make the sample-vs-population choice explicit.
STDEV.S vs STDEV.P
Both functions compute the same kind of spread around the mean. The difference is in the denominator:
- STDEV.S divides by n − 1 (the count minus one). This is Bessel's correction.
- STDEV.P divides by n (the total count).
If you have measurements for an entire group (every employee in a small company, every test score in one class), STDEV.P is correct. If your numbers are a sample of a bigger group (a survey of 100 customers, 30 days of stock prices), STDEV.S is correct.
For the underlying formulas in detail and a step-by-step walkthrough of the math, see Standard Deviation Formula. For a deeper look at the underlying choice between sample and population, which is what STDEV.S and STDEV.P really are, see Sample vs Population Standard Deviation.
How to calculate sample standard deviation in Excel
Use STDEV.S. The syntax is:
=STDEV.S(value1, value2, ...)
You can pass:
- A range of cells: =STDEV.S(A2:A9)
- A list of values: =STDEV.S(2, 4, 4, 4, 5, 5, 7, 9)
Excel returns the sample standard deviation. Blank cells and text values inside the range are ignored automatically.
How to calculate population standard deviation in Excel
Use STDEV.P. Same syntax, just swap the function name:
=STDEV.P(A2:A9)
Or with a list of values:
=STDEV.P(2, 4, 4, 4, 5, 5, 7, 9)
The result is the population standard deviation, with the same handling of blanks and text.
Step by step Excel example
We will use the same small data set used across the other standard deviation guides:
2, 4, 4, 4, 5, 5, 7, 9
The next four sections walk through the calculation in Excel one step at a time.
Step 1: Put your data in one column
Open Excel and put each number in its own cell, top to bottom in a single column.
- A1: a header label like “Score” (optional but useful for clarity)
- A2 through A9: the eight values, one per cell
Avoid putting totals or summary rows inside the data range. They will skew the result if Excel treats them as data points.
Step 2: Choose STDEV.S or STDEV.P
Decide which formula matches your data. For this example, treat the eight values as a sample, so reach for STDEV.S. If those eight values were the entire population (every score in a small class, for instance), you would use STDEV.P instead.
This decision matters: the two functions give different answers on the same data, especially with small data sets.
Step 3: Enter the formula
In an empty cell (say B2), type:
=STDEV.S(A2:A9)
Press Enter. Excel returns approximately 2.138.
For the population version, use =STDEV.P(A2:A9), which returns exactly 2.
Step 4: Check the result
Excel's number is fast, but it is worth a sanity check the first time you use a new formula. Two ways to check:
- Open the standard deviation calculator, paste the same numbers, and compare. The calculator reports both sample and population standard deviation alongside the mean and variance, so the figure you want should match exactly.
- For a small data set, doing the manual math once is the most thorough check. See Standard Deviation Formula for the step-by-step walkthrough.
If your Excel result and your check disagree, the most common culprit is using the wrong function (sample vs population).
Common Excel standard deviation mistakes
A few traps that catch people:
- Mixing up STDEV.S and STDEV.P. Easy to do, big difference in result, especially with small data sets.
- Numbers stored as text. STDEV.S and STDEV.P automatically ignore text values, so if a cell contains a number stored as text, that value is silently excluded. Look for tiny green triangles in the corner of cells, which Excel uses to flag this.
- Including totals or headers in the range. =STDEV.S(A1:A10) where A1 is “Score” and A10 is a sum row will give a misleading answer.
- Using the legacy STDEV function. It is identical to STDEV.S in modern Excel, but using STDEV.S makes your sample-vs-population intent clear to anyone reading the workbook later.
- Forgetting to fix references. If you copy the formula across columns, =STDEV.S(A2:A9) becomes =STDEV.S(B2:B9), which may or may not be what you wanted.
Variance has its own pair of Excel functions (VAR.S and VAR.P) that work the same way. For the relationship between variance and standard deviation, see Variance vs Standard Deviation.
Excel vs standard deviation calculator
Both Excel and a dedicated calculator use the same underlying math. The choice is about context.
- Use Excel when your data already lives in a spreadsheet and you want the result inline with other analysis.
- Use the standard deviation calculator when you want a quick answer outside Excel, when you do not have Excel handy, or when you want to double-check an Excel result.
For a longer plain-language explanation of what the result actually means, see What Is Standard Deviation?
Quick summary
- STDEV.S is sample standard deviation. Use this most of the time.
- STDEV.P is population standard deviation. Use only when you have data for the whole group.
- Syntax: =STDEV.S(range) or =STDEV.S(value1, value2, ...).
- Excel ignores blank cells and text inside the range automatically.
- Watch for numbers stored as text, headers, and totals leaking into the range.
- Cross-check with the standard deviation calculator if a result looks off.
Run the numbers
Three calculators that pair well with the Excel functions in this guide.
Standard Deviation Calculator
Mean, population and sample standard deviation, and both variances from a list of numbers.
Variance Calculator
Population and sample variance, mean, count, and standard deviation in one step.
P Value Calculator
Convert a z-score (in standard deviation units) to a one-tailed or two-tailed p-value.
Frequently asked questions
Excel offers STDEV.S for sample standard deviation and STDEV.P for population standard deviation. Both take either a range like A2:A9 or a list of values. STDEV.S divides by n − 1; STDEV.P divides by n.
Use STDEV.S when your data is a sample of a larger group, which covers most everyday cases. Use STDEV.P only when your data covers the entire population. When in doubt, default to STDEV.S.
STDEV.S is Excel's sample standard deviation function. It assumes your numbers are a sample drawn from a larger population and divides by n − 1 (Bessel's correction) to give an unbiased estimate of population spread.
STDEV.P is Excel's population standard deviation function. It treats your numbers as the entire population and divides by n. Use it only when you genuinely have data for everyone or everything in the group.
Put your numbers in a single column (for example A2:A9). In an empty cell, enter =STDEV.S(A2:A9) for sample standard deviation or =STDEV.P(A2:A9) for population standard deviation. Press Enter and Excel returns the result.
Almost always because one tool is using sample standard deviation (n − 1) and the other is using population standard deviation (n). Check which formula each tool uses. Excel's STDEV.S and many online calculators default to sample.
Yes, with built-in functions. Modern Excel uses STDEV.S and STDEV.P as the primary functions, plus VAR.S and VAR.P for variance. Older workbooks may use STDEV and STDEVP, which are equivalent to STDEV.S and STDEV.P but legacy.
Both work for the same math. Use Excel when your data already lives in a spreadsheet. Use a standard deviation calculator outside Excel for a quick answer or to sanity-check an Excel result. The numbers should match as long as both tools use the same sample-vs-population choice.