How to Calculate Standard Deviation in Excel
Excel has six functions that compute standard deviation, and picking the wrong one silently changes your answer. This guide walks through which function to use, a fully worked example you can reproduce in any version of Excel, and the mistakes that most commonly produce wrong results.
Which function should you use?
Excel splits every statistical function into an older pair and a modern pair, and each pair comes in a sample and a population flavour:
| Function | Type | Divides by | Use when |
|---|---|---|---|
STDEV.S | Sample | n − 1 | Your data is a sample of a larger group (the common case) |
STDEV.P | Population | n | Your data is the entire population |
STDEV | Sample (legacy) | n − 1 | Old workbooks only; identical result to STDEV.S |
STDEVP | Population (legacy) | n | Old workbooks only; identical result to STDEV.P |
STDEVA | Sample | n − 1 | Text and logical values should count in the calculation |
STDEVPA | Population | n | Same, for a full population |
In nearly every real task the right choice is STDEV.S. The legacy names still work but exist only for compatibility with spreadsheets from the 1990s; new work should use the modern names. The A-variants are a trap: they treat text entries as zero and TRUE/FALSE as 1/0, which is almost never what you intend.
A worked example
Put these eight values in cells A1 to A8: 12, 15, 17, 14, 19, 21, 16, 13.
- In cell A9 type
=STDEV.S(A1:A8). Excel returns 3.04432… - In cell A10 type
=STDEV.P(A1:A8). Excel returns 2.84777… — smaller, because it divides by 8 instead of 7. - To see the intermediate arithmetic, type
=AVERAGE(A1:A8)(15.875) and=VAR.S(A1:A8)(9.26786). The square root of the variance is the standard deviation: √9.26786 ≈ 3.04432.
You can check both numbers instantly with the standard deviation calculator — paste the same column and it reproduces every step.
Method 2: Data Analysis ToolPak
If you prefer a dialog to formulas: enable the ToolPak under File → Options → Add-ins → Excel Add-ins → Analysis ToolPak, then open Data → Data Analysis → Descriptive Statistics, select your range, tick "Summary statistics" and read "Standard Deviation" from the output table. Note the ToolPak always reports the sample statistic, so there is no way to get the population figure from it.
Common mistakes
- Using STDEV.P on sample data. The result is biased low, and the error shrinks with n so it slips through on big datasets. Default to STDEV.S unless the data truly is the whole group.
- Hidden rows and blanks. STDEV.S ignores blank cells and text — usually right, but if a blank means "measurement lost" rather than "not applicable", your n is wrong even though the formula runs without complaint.
- Numbers stored as text. A column pasted from a PDF often contains text-formatted numbers; STDEV.S silently skips them and divides by a smaller n. Watch the count bar in Excel's status bar.
- Including the header row. A1:A9 with a title in A1 does not error — the text is just ignored, changing your divisor.
Related functions worth knowing
VAR.S/VAR.P— the variance, i.e. SD squared.=STDEV.S(range)/SQRT(COUNT(range))— the standard error of the mean, used for confidence intervals.AVEDEV— the mean absolute deviation, a more robust (and less common) alternative measure of spread.
Excel vs doing it by hand
Excel computes with full double precision internally and displays rounded values, so an answer like 3.0443 may really be 3.044324… underneath. If you chain calculations, reference the SD cell rather than retyping the rounded number, or you will accumulate rounding drift. For quick checks and teaching, the working shown by an online calculator is often clearer than a bare cell result.
FAQ
Does Excel have a single function that decides sample vs population for me?
No — that is deliberate. Excel cannot know whether your data is a sample, so you must choose. When in doubt, STDEV.S.
Why do STDEV and STDEV.S give the same answer?
STDEV.S is the renamed successor of STDEV with identical mathematics. Microsoft introduced the new names around 2010 for consistency.
How do I put the SD into a chart as error bars?
Compute the SD in a cell, then set the chart's custom error-bar value to that cell (±). For means with uncertainty, use the standard error instead of the SD.
Is STDEV.S available in Google Sheets?
Yes, Google Sheets supports STDEV.S and STDEV.P with the same behaviour.