Standard Deviation Calculator
Build a STDEV.S or STDEV.P formula to measure how spread out a set of numbers is.
STDEV.S
Build a STDEV.S or STDEV.P formula to measure how spread out a set of numbers is.
Type STDEV.S when your numbers are a sample of a larger group, or STDEV.P when the range is the entire population. Any other text here produces a #NAME? error.
The cells holding your numbers. Text, TRUE/FALSE, and empty cells inside the range are skipped.
=STDEV.S(A2:A100)Worked Example
Eight test scores in A2:A9 (2, 4, 4, 4, 5, 5, 7, 9) taken as a sample of a much larger class.
=STDEV.S(A2:A9)Returns: Returns about 2.14 (2.1381 to four decimals). Switching to =STDEV.P(A2:A9) on the same numbers returns exactly 2, because it divides by 8 instead of 7.
Checks Before You Paste
- •STDEV.S divides by n-1 because a sample underestimates the spread of the group it came from; STDEV.P divides by n. STDEV.S therefore returns the larger number on any range that actually varies, and on small ranges the gap is wide: eight values give 2.14 versus 2.00 on the same data. The two agree only when every value is identical and both return 0.
- •STDEV.S returns #DIV/0! when the range holds fewer than two numbers. Text, logical values, and blanks inside a range reference are ignored rather than counted as zero, so numbers accidentally stored as text silently shrink n and skew the result with no error to warn you.
- •The legacy STDEV and STDEVP names still work in every Excel version and return exactly the same values as STDEV.S and STDEV.P. STDEVA and STDEVPA are different: they count text as 0 and TRUE as 1, which is almost never what you want.
How STDEV.S works
Availability: STDEV.S and STDEV.P were introduced in Excel 2010. The older names STDEV and STDEVP still work in every version, including Microsoft 365, and return identical results. Google Sheets has all four, plus STDEVA and STDEVPA.
Standard deviation measures how far the values in a set typically sit from their own average. A low number means the values cluster; a high number means they are spread out. It is in the same units as the data, which is why it is quoted alongside an average far more often than variance is - a mean order of 22 units with a standard deviation of 4.4 tells a reader something immediately.
The choice between STDEV.S and STDEV.P is a statement about what your range represents, not about how accurate you want to be. STDEV.S treats the numbers as a sample drawn from a larger group and divides the summed squared deviations by n-1. STDEV.P treats them as the entire population and divides by n. Because a sample tends to understate the spread of the group it came from, the n-1 denominator corrects upward, so STDEV.S always returns the larger figure on data that varies at all. Use .P only when the range genuinely is everything: all twelve months of one closed year, every employee on the payroll today. Anything that is a measurement, a survey or an ongoing process is a sample.
Both functions ignore text, TRUE/FALSE and empty cells found inside a range reference, and they count zeros as real numbers. That leniency is a trap rather than a convenience: numbers imported as text are skipped silently, which shrinks n and changes the answer with no error to warn you. Comparing =COUNT(range) with =COUNTA(range) is the fastest check. Values typed directly as arguments behave differently again - =STDEV.S(1, 2, "3", TRUE) counts the text and the logical value, while the same entries inside a range would be ignored.
STDEV.S needs at least two numbers and returns #DIV/0! with fewer. STDEVA and STDEVPA look like convenient variants but count text as 0 and TRUE as 1, which drags the result toward zero and is almost never what anyone intends.
Syntax
=STDEV.S(number1, [number2], ...) / =STDEV.P(number1, [number2], ...)| Argument | Required | What it does |
|---|---|---|
number1 | Required | The first number, cell reference or range. A single range such as A2:A100 is the usual form and covers the whole calculation. |
number2, ... number255 | Optional | Further numbers or ranges, up to 255 arguments, pooled with the first. Useful for combining non-adjacent columns: =STDEV.S(A2:A50, D2:D50). Text and logical values are ignored inside ranges but counted when typed directly as arguments. |
More worked examples
Six days of order counts in A2:A7: 18, 22, 19, 25, 30 and 21, taken as a sample of normal trading.
=STDEV.S(A2:A7)Returns: Returns about 4.42 (4.4159 to four decimals). =STDEV.P(A2:A7) on the same six numbers returns about 4.03, because it divides by 6 instead of 5.
Setting an upper control limit two standard deviations above the mean of the same six days.
=AVERAGE(A2:A7)+2*STDEV.S(A2:A7)Returns: Returns about 31.33: an average of 22.5 plus 8.83. A day above that line is worth investigating.
For a lower limit, subtract instead. On counts that cannot go below zero, clamp the result with MAX(0, ...).
A column A2:A11 where three of the ten entries were imported as text and look identical to the rest.
=STDEV.S(A2:A11)Returns: Returns the standard deviation of the seven real numbers only, with no error or warning. =COUNT(A2:A11) returns 7 while =COUNTA(A2:A11) returns 10, which is how you spot it.
Common mistakes
- #DIV/0! from a range with fewer than two numbers
- STDEV.S cannot divide by n-1 when n is 1, so a single value, or a range where everything else is text or blank, returns #DIV/0!. STDEV.P returns 0 in the same situation, which is arguably worse because it looks like an answer.
- Numbers stored as text quietly shrink the sample
- Ranges ignore text, so a column pasted from a web page or a PDF can lose half its values without erroring. Check with COUNT against COUNTA, then convert the column to real numbers before trusting the result.
- Typed arguments follow different rules from ranges
- =STDEV.S(2, 4, "6") counts the text "6" as 6 and returns 2, while putting the same three entries in cells and using =STDEV.S(A2:A4) ignores the text and returns 1.414 from two values. The inconsistency is documented behaviour, not a bug, and it is a good reason to always point the function at a range.
- Choosing .P because the numbers look complete
- Having every row you collected is not the same as having the whole population. Twelve months of sales are a sample of an ongoing business, not a population, and using STDEV.P there understates the spread - noticeably so on small ranges, where the two functions can differ by several per cent.
- Filtered rows are still included
- STDEV.S reads every cell in the range whether or not a filter is hiding it, so the figure on screen does not match the visible rows. Use =SUBTOTAL(107, A2:A100) for a sample standard deviation that respects the filter, or 108 for the population version.
Frequently Asked Questions
STDEV.S unless your range is literally the entire group you are describing. Test scores from one class you are treating as the whole population take .P; the same scores used to say something about the year group take .S. When in doubt, .S is the safer choice because it never understates the spread.
Because the range holds fewer than two numeric values. Either the range is a single cell, or the other entries are blank, text or logical values and are being ignored. Count the real numbers with =COUNT(range) to confirm before changing the formula.
Yes. STDEV and STDEVP are the pre-2010 names, kept for backwards compatibility, and they return exactly the same values as STDEV.S and STDEV.P. Use the newer names in new work - the dot makes the sample-versus-population choice visible to whoever reads the formula next.
Use SUBTOTAL: =SUBTOTAL(107, A2:A100) gives a sample standard deviation of the visible rows only, and 108 gives the population version. Function numbers 7 and 8 do the same calculation but still include rows hidden by a filter.
They include text and logical values instead of skipping them, counting any text as 0 and TRUE as 1. On a column with a few blank-looking text entries that turns real values into zeros and inflates the spread wildly. Unless you specifically want that treatment, stay with STDEV.S and STDEV.P.
Related Tools
Weighted Average Generator
When the values being summarised do not all carry equal importance.
MEDIAN Generator
A spread-resistant centre point to quote alongside, or instead of, the mean.
Excel Data Profiler
Column-by-column counts, ranges and distributions for a file you upload.
AVERAGEIF Generator
Averages restricted to rows that meet a condition, useful before comparing group spreads.