ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Math
  3. How to Calculate Standard Deviation in Excel

How to Calculate Standard Deviation in Excel

By ExcelReady Team·Updated November 2, 2026·7 min read

The short answer

To calculate standard deviation in Excel, use =STDEV.S(B2:B7) when your data is a sample, or =STDEV.P(B2:B7) when it covers the whole group you care about. Standard deviation measures how far values typically sit from the average. A small result means the values are close together; a large one means they are spread out.

Key takeaways

  • Standard deviation shows how spread out values are around the average, in the same units as the data.
  • STDEV.S is for a sample and divides by n − 1. STDEV.P is for a whole population and divides by n.
  • STDEV and STDEVP are the older names for STDEV.S and STDEV.P and give the same results.
  • Divide the standard deviation by the average to compare spread between groups of different sizes.
  • Use SUBTOTAL or AGGREGATE to get the standard deviation of only the visible rows in a filtered list.
On this page+
  1. What standard deviation tells you
  2. How to calculate standard deviation in Excel
  3. STDEV.S or STDEV.P: which one to use
  4. How to calculate standard deviation by hand
  5. Compare spread with the coefficient of variation
  6. Standard deviation with conditions or filters
  7. Common standard deviation mistakes
  8. Practise it

To calculate standard deviation in Excel, use =STDEV.S(range) for a sample or =STDEV.P(range) for a whole population. Standard deviation tells you how spread out your numbers are around the average: whether most values sit close to it or swing far above and below. This guide explains which function to pick, what the result means, and how to work it out step by step.

What standard deviation tells you#

Standard deviation measures how far values typically are from the average, in the same units as the data. Two lists can have the same average and very different spreads.

Here are six weeks of unit sales from two shops:

WeekShop AShop B
11412
21415
3139
41518
51414
61416
Average1414
STDEV.S0.633.16

Both shops average 14 units a week. Shop A is steady: its standard deviation is about 0.6 units. Shop B swings from 9 to 18, and its standard deviation is about 3.2 units. The average alone hides that difference. The guide to AVERAGE, MIN and MAX covers the other basic summaries you'd put next to it.

For data with a rough bell shape, about two-thirds of the values fall within one standard deviation of the average. For Shop B, that is between about 10.8 and 17.2.

How to calculate standard deviation in Excel#

Select an empty cell and type STDEV.S with the range of numbers. With Shop B's sales in B2:B7:

Excel formula
=STDEV.S(B2:B7)

The result is 3.16 (3.1623 to four places). That's all you need for most reports.

STDEV.S ignores empty cells, text and TRUE/FALSE values in the range. It needs at least two numbers, or it returns #DIV/0!.

STDEV.S or STDEV.P: which one to use#

Use STDEV.S for a sample and STDEV.P for a complete population. The only difference is what they divide by.

FunctionUse whenDivides byShop B result
STDEV.SYour data is a sample of a bigger groupn − 13.16
STDEV.PYour data is the whole groupn2.89

A sample is part of a bigger group, such as six weeks out of a year of sales, or 50 customers out of thousands. A population is every member of the group you're describing, such as all ten people on one team. Dividing by n − 1 makes the sample result slightly larger, to allow for the values you didn't see. When in doubt, use STDEV.S: most business and test data is a sample.

You may also meet these related functions:

  • STDEV and STDEVP are the older names (before Excel 2010). They give the same results as STDEV.S and STDEV.P and still work.
  • STDEVA and STDEVPA count text as 0 and TRUE as 1. You rarely want that.
  • VAR.S and VAR.P return the variance, which is the standard deviation squared: 10 and 8.33 for Shop B.

How to calculate standard deviation by hand#

Doing it once by hand makes the result easy to understand. For Shop B:

WeekUnitsDistance from average (14)Distance squared
112−24
21511
39−525
418416
51400
61624
Total50
  1. Find the average with the AVERAGE function: 14.
  2. Subtract the average from each value and square the result, so negative distances don't cancel positive ones.
  3. Add the squares: 50.
  4. Divide by n − 1 for a sample (50 / 5 = 10) or by n for a population (50 / 6 = 8.33). This is the variance.
  5. Take the square root: √10 = 3.16 for a sample, √8.33 = 2.89 for a population.

One formula does all five steps:

Excel formula
=SQRT(SUMPRODUCT((B2:B7-AVERAGE(B2:B7))^2)/(COUNT(B2:B7)-1))

It returns 3.16, the same as STDEV.S. Remove the -1 and it matches STDEV.P.

Compare spread with the coefficient of variation#

A standard deviation of 3 means a lot when the average is 14 and very little when it is 1,400. To compare groups with different averages, divide the standard deviation by the average:

Excel formula
=STDEV.S(B2:B7)/AVERAGE(B2:B7)

This is the coefficient of variation. For Shop B it is 0.226, or about 23% when formatted as a percentage. Shop A is about 5%. Lower means steadier.

Standard deviation is sensitive to outliers, because squaring makes big distances count heavily. If one huge value skews your data, look at the median as well. The guide to AVERAGE vs MEDIAN explains when the middle value is the better summary, and MEDIAN and MODE shows how to calculate both.

Standard deviation with conditions or filters#

Excel has no STDEVIFS function, but you can still get the spread for one group.

For one category in Excel 2021 or Microsoft 365, put IF inside STDEV.S. If column A holds regions and column C holds sales:

Excel formula
=STDEV.S(IF(A2:A50="North",C2:C50))

IF keeps the North sales and turns the rest into FALSE, which STDEV.S ignores. In Excel 2019 and earlier, confirm it as an array formula with Ctrl+Shift+Enter (Mac: ⌘+Shift+Return).

For a filtered list, use SUBTOTAL so hidden rows are left out. Function number 7 is the sample standard deviation and 8 is the population one:

Excel formula
=SUBTOTAL(7,C2:C50)

With rows hidden by a filter, only the visible ones are used. The guide to the SUBTOTAL function lists all the function numbers. AGGREGATE works the same way and can also skip error values.

To measure how precise an average is, divide by the square root of the count. This is the standard error: =STDEV.S(B2:B7)/SQRT(COUNT(B2:B7)) returns 1.29 for Shop B.

Common standard deviation mistakes#

These are the slips that give wrong results most often:

  1. Using STDEV.P for a sample. It gives a result that's too small. Use STDEV.S unless you have every value.
  2. Including the total row. A range like B2:B8 that takes in a total in B8 adds one huge value.
  3. Numbers stored as text. They're ignored, so the count is lower than you think. Check with COUNT.
  4. Comparing raw standard deviations. Groups with different averages need the coefficient of variation.
  5. Weighting. STDEV.S treats every value equally. If rows represent different sizes, the plain result is misleading, much like a plain average versus a weighted average.

Practise it#

Standard deviation builds on the average, so make the basics automatic first. Practise AVERAGE, MIN and MAX in a live spreadsheet: you type each formula and the sheet checks it instantly. Then compare middle values in the MEDIAN and MODE lesson, and work out a standard deviation by hand in the exercise on this page.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Work out the sample standard deviation of the weekly sales by hand. Click D2 and type =SQRT(SUMPRODUCT((B2:B7-AVERAGE(B2:B7))^2)/(COUNT(B2:B7)-1)).

fx
ABCDE
1
Week
Units
2
Week 1
12
Std dev
3
Week 2
15
4
Week 3
9
5
Week 4
18
6
Week 5
14
7
Week 6
16
8
9
10

Tip: Square each value's distance from the average, add them up, divide by the count minus 1, then take the square root.

Practise this in a lesson

LessonAVERAGE, MIN and MAXSummarize a list with its average, smallest and largest values.LessonMEDIAN and MODESee how one outlier skews an average, and describe typical values with MEDIAN and MODE.Function guideAVERAGECalculate the mean in Excel with AVERAGE. See how it treats blanks and zeros, avoid common errors, and practice in a live sheet.

Frequently asked questions

What is the formula for standard deviation in Excel?

+

Use =STDEV.S(range) for a sample, such as =STDEV.S(B2:B7). Use =STDEV.P(range) when the data includes every member of the group, such as all employees in one team.

Should I use STDEV.S or STDEV.P?

+

Use STDEV.S when your data is a sample from a bigger group, which is the usual case in surveys and tests. Use STDEV.P only when you have every value in the group you are describing.

What is a good standard deviation?

+

There is no single good value. It depends on the average and the units. Compare it with the average: a standard deviation of 3 is large next to an average of 14 but tiny next to 1,400.

How do I calculate variance in Excel?

+

Use VAR.S for a sample or VAR.P for a population. Variance is the standard deviation squared, so =SQRT(VAR.S(B2:B7)) equals =STDEV.S(B2:B7).

Why does STDEV.S return #DIV/0!?

+

STDEV.S needs at least two numbers, because it divides by the count minus one. Check that the range holds two or more numbers and that they are not stored as text.

Sources

  • AVERAGE function - Microsoft Support
  • SQRT function - Microsoft Support
  • SUMPRODUCT function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What standard deviation tells you
  2. How to calculate standard deviation in Excel
  3. STDEV.S or STDEV.P: which one to use
  4. How to calculate standard deviation by hand
  5. Compare spread with the coefficient of variation
  6. Standard deviation with conditions or filters
  7. Common standard deviation mistakes
  8. Practise it

Keep reading

Math· 5 min read

AVERAGE, MIN and MAX in Excel With Examples

AVERAGE returns the mean of a range, MIN returns the smallest number and MAX returns the largest. All three take the same input: =AVERAGE(B2:B6), =MIN(B2:B6) and =MAX(B2:B6). They skip empty cells and text but count zeros, and =MAX(B2:B6)-MIN(B2:B6) shows how spread out the values are.

Math· 6 min read

MEDIAN and MODE in Excel: Find the Typical Value

MEDIAN returns the middle value of a range once it is sorted, and MODE returns the value that appears most often. Type =MEDIAN(B2:B8) or =MODE(D2:D11). Use MEDIAN instead of AVERAGE when one extreme value, like a founder's salary, would pull the average away from what is typical. MODE returns #N/A if nothing repeats.

Comparisons· 7 min read

AVERAGE vs MEDIAN: Which Tells the Truth?

Use MEDIAN to describe a typical value when a few very large or very small numbers could skew the result, such as salaries, house prices or order values. Use AVERAGE when the values are fairly even, or when you need a number that multiplies back to the total, as in budgets. When the two differ a lot, report both.

More on math

  • How to Sum Every Other Row or Every Nth Row in Excel
  • The Excel SUM Function: A Beginner's Guide
  • How to Sum and Ignore Errors in Excel
  • How to Sum Multiple Columns in Excel
  • How to Sum the Top 5 (or Top N) Values in Excel
  • How to Sum Only Visible (Filtered) Cells in Excel
All math articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free