How To Calculate Standard Deviation In Excel (2026)
To calculate standard deviation in Excel, type =STDEV.S(A2:A11) for a sample or =STDEV.P(A2:A11) for a whole population, then press Enter.
Standard deviation tells you how widely the values in your data spread out from their average.
This guide covers which function to pick, how each one treats blanks, text and TRUE or FALSE, and what to do when you get an error.
Table of Contents
- Quick answer: which standard deviation function to use
- Get your data ready
- Decide between sample and population
- How to calculate standard deviation for a sample with STDEV.S
- How to calculate standard deviation for a population with STDEV.P
- Use the Insert Function box instead of typing
- What each function counts and ignores
- Population versions that include logicals and text
- Old function names you may still see
- Which Excel versions support these functions
- Fix common errors and wrong results
- Turn on the Analysis ToolPak if you need it
- Related Excel guides
- More Word, Excel and PowerPoint guides
Quick answer: which standard deviation function to use
| Your data is | Function | Divides by |
|---|---|---|
| A sample taken from a larger group | =STDEV.S(A2:A11) | n-1 |
| The entire population | =STDEV.P(A2:A11) | n |
| A sample that includes TRUE, FALSE or text you want counted | =STDEVA(A2:A11) | n-1 |
The function details below come from Microsoft’s STDEV.S and STDEV.P pages.
Get your data ready
Put the numbers you want to measure in one column or row, such as A2:A11.
Keep any heading in a separate cell outside the range, because Microsoft’s own example uses A3:A12 so the header and label are left out.
Excel lists no more than 254 number arguments in either function, and each argument can be a whole range.
Decide between sample and population
Use a sample function when your numbers are only part of a bigger group, such as 10 tools tested out of a whole production run.
Use a population function when your numbers are every value in the group you care about.
Microsoft says STDEV.S assumes its arguments are a sample of the population, and that you should use STDEV.P when your data covers the entire population.
For large data sets the two results end up close to each other, according to the STDEV.P page.
How to calculate standard deviation for a sample with STDEV.S
- Click an empty cell where you want the answer.
- Type =STDEV.S( and then select the cells, or type the range such as A2:A11.
- Type the closing bracket and press Enter.
With Microsoft’s breaking-strength numbers (1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303 and 1299), the result is 27.46391572.
STDEV.S uses the n-1 method, which is why it comes out larger than the population version on the same numbers.
How to calculate standard deviation for a population with STDEV.P
- Click an empty cell.
- Type =STDEV.P( and select the same range.
- Close the bracket and press Enter.
On the same ten values, Microsoft shows a result of 26.05455814, because STDEV.P uses the n method and divides by the number of values.
| Formula on the same 10 values | Result on Microsoft’s page |
|---|---|
=STDEV.S(A3:A12) | 27.46391572 |
=STDEV.P(A3:A12) | 26.05455814 |
=STDEVA(A3:A12) | 27.46391572 |
The STDEVA result matches STDEV.S here because every value is a plain number.
Use the Insert Function box instead of typing
- Select the cell for the result.
- Select the Insert function button (the fx icon) to open the Insert Function dialog box.
- Type a short description such as standard deviation in the search box and select Go.
- Select a function name once to read its syntax and short description.
- Double-click the name to open the Function Arguments window.
- Pick your cells in the Number1 box and select OK.
The same dialog has a Help on this function link that opens Microsoft’s reference page for the function you have selected.
What each function counts and ignores
| Item in the range | STDEV.S and STDEV.P | STDEVA |
|---|---|---|
| Numbers | Counted | Counted |
| Empty cells | Ignored | Ignored |
| Text in a reference | Ignored | Ignored |
| TRUE in a reference | Ignored | Counted as 1 |
| FALSE in a reference | Ignored | Counted as 0 |
| Error value in a reference | Ignored in the array or reference | Causes an error |
Microsoft’s STDEVA page says text and FALSE evaluate as 0 and TRUE evaluates as 1, while empty cells and text values in an array or reference are ignored.
Numbers typed straight into the formula work differently, because logical values and numbers written as text are counted there.
Population versions that include logicals and text
STDEV.P ignores logical values and text in a range.
To include them for a whole population, Microsoft points you to STDEVPA.
To include them for a sample, use STDEVA.
Old function names you may still see
| Older name | What Microsoft lists it as |
|---|---|
| STDEV | Listed as a related function on the STDEV.S page |
| STDEVP | Listed as a related function on the STDEV.S page |
| STDEVPA | Population version that includes logicals and text |
The STDEV.P page tells you to use STDEV for sample data, so files made years ago may still carry it.
Which Excel versions support these functions
Microsoft lists STDEV.S and STDEV.P for Excel for Microsoft 365 on Windows and Mac, Excel for the web, Excel 2024, Excel 2021, Excel 2019 and Excel 2016.
That covers most copies in use today.
Fix common errors and wrong results
| Symptom | Likely cause | Fix |
|---|---|---|
| #NAME? | A typo in the function name | Correct the spelling and use the autocomplete list that appears as you type |
| Error from a typed argument | Text that cannot be turned into a number | Replace it with a number or a cell reference |
| Error from a range | A cell in the range holds an error value, and you used STDEVA | Fix the error cell or switch to STDEV.S |
| Result looks too small or too large | Sample and population functions swapped | Check which one matches your data |
| Text-stored numbers skipped | Numbers in a range stored as text are ignored | Convert them to real numbers first |
Microsoft says the most common cause of a #NAME? error is a typo in the formula name, and it warns against hiding the error with IFERROR.
For other formula errors, see our guide to fixing #N/A, #VALUE! and #REF! errors in Excel.
Turn on the Analysis ToolPak if you need it
- Select File, then Options, then Add-Ins.
- In the Manage box, select Excel Add-ins, then select Go.
- Check Analysis ToolPak and select OK.
- If it is not listed, select Browse to find it, and select Yes if Excel offers to install it.
Microsoft’s Load the Analysis ToolPak page adds that these tools work on one worksheet at a time.
With grouped worksheets, results appear on the first sheet and the others get empty formatted tables, so you run the tool again on each sheet.
Related Excel guides
If you want totals first, read how to use AutoSum and the SUM function in Excel.
For ratios, see how to calculate a percentage in Excel.
For date work, see how to calculate days between dates in Excel.
The full list of statistical functions is on Microsoft’s Statistical functions reference.