Excel has two built-in functions for standard deviation, and which one you use depends on whether your data is a sample or an entire population

The STDEV.S function calculates standard deviation for a sample — a subset of a larger group. The STDEV.P function calculates it for an entire population. Most of the time you will use STDEV.S, because you are usually working with sample data rather than every single data point that exists. If you have collected measurements from all members of a group with no exceptions, use STDEV.P instead.

Both functions work the same way: you type the function name, then list the cells containing your numbers in parentheses. Excel then returns a single number representing how spread out your data is — a larger number means your values are more scattered, a smaller number means they cluster closer together.

Key Takeaways

  • Use STDEV.S for sample data and STDEV.P for data representing an entire population, and most datasets are samples.
  • Type =STDEV.S(A1:A10) to calculate standard deviation for cells A1 through A10, replacing the range with your actual cell locations.
  • You can list individual cells separated by commas (=STDEV.S(A1,A3,A5)) or use a continuous range (=STDEV.S(A1:A10)) or combine both methods.
  • Excel ignores empty cells and text within your range, but will return an error if you include cells with text that cannot be converted to numbers.
  • The result appears in the cell where you typed the formula, and you can copy the formula down to calculate standard deviation for different ranges.

Setting up your data and choosing your function

Before you write a formula, decide whether your numbers represent a sample or a population. A sample is a subset — test scores from 30 students in a class of 200, or daily temperatures from one month, or product weights from a factory batch. A population is everything — all students in that class, all days in a year, or every single item produced. When in doubt, you are working with a sample, so STDEV.S is the right choice.

Arrange your numbers in a column or row so you can reference them easily. You do not need to sort them or clean them up — Excel handles that automatically. If your data is scattered across different areas of the spreadsheet, you can still include all of it in one formula by listing each range or cell separately.

Writing the formula for sample data

Click the cell where you want the result to appear. Type =STDEV.S( and then specify which cells contain your numbers. The simplest way is to type a range: =STDEV.S(A1:A10) calculates standard deviation for cells A1 through A10. Press Enter, and Excel displays the result.

If your data is not in one continuous block, list each range or cell separated by a comma: =STDEV.S(A1:A5,A10:A15,A20) includes cells A1 through A5, A10 through A15, and cell A20. You can mix ranges and individual cells in the same formula. Excel adds all the numbers you reference into one calculation.

You can also select the range by clicking and dragging. Type =STDEV.S( then click the first cell, hold down the mouse button, and drag to the last cell you want to include. Excel automatically fills in the range for you. Release the mouse button, type the closing parenthesis, and press Enter.

Writing the formula for population data

The process for STDEV.P is identical to STDEV.S — only the function name changes. Type =STDEV.P(A1:A10) to calculate standard deviation for an entire population in cells A1 through A10. You can use ranges, individual cells, or a combination of both, just as you would with STDEV.S.

STDEV.P produces a smaller number than STDEV.S for the same dataset because it assumes you have all the data and there is no uncertainty from sampling. In practice, STDEV.P is less common because most real-world datasets are samples rather than complete populations.

Copying the formula to other cells

Once you have written a formula in one cell, you can copy it to calculate standard deviation for other ranges. Click the cell containing your formula, then copy it (Ctrl+C on Windows, Command+C on Mac). Select the cells where you want the formula to appear and paste (Ctrl+V or Command+V).

When you paste, Excel automatically adjusts the cell references. If your original formula was =STDEV.S(A1:A10) and you paste it one row down, it becomes =STDEV.S(A2:A11). This is usually what you want, but check the formula in each cell to make sure the ranges are correct for your data.

Handling errors and unusual data

Excel ignores empty cells within your range, so gaps in your data do not cause problems. Text values are also ignored unless they look like numbers — "5" is treated as a number, but "five" is skipped. If all your cells contain text or are empty, Excel returns a #DIV/0! error because there is nothing to calculate.

If you see a #VALUE! error, one of your cells contains text that Excel cannot interpret as a number. Check your range for typos, extra spaces, or cells formatted as text instead of numbers. You can also use the STDEV.S or STDEV.P function with a range that includes only the cells you know contain numbers, leaving out the problematic cells.

Dates and times are stored as numbers in Excel, so they are included in standard deviation calculations. If you do not want them included, reference only the cells containing the values you want to measure.

Understanding what the result means

Standard deviation tells you how far, on average, your numbers are from the middle value. A small standard deviation means most of your numbers are close to the average. A large standard deviation means your numbers are spread out over a wider range. The units of standard deviation are the same as your original data — if you are measuring height in inches, standard deviation is also in inches.

For example, if you calculate standard deviation for test scores and get 8.5, that means the typical score is about 8.5 points away from the average score. If you calculate standard deviation for the same test and get 2.1, the scores are much more tightly clustered around the average. Standard deviation is useful for comparing how consistent different datasets are, or for understanding whether an individual value is typical or unusual.

Frequently Asked Questions

What is the difference between STDEV.S and STDEV.P?

STDEV.S calculates standard deviation for a sample, assuming your data is part of a larger group. STDEV.P calculates it for a complete population, assuming you have all the data. STDEV.S produces a slightly larger number because it accounts for the uncertainty of sampling. Use STDEV.S unless you are certain your data represents every single value in the group.

Can I use STDEV instead of STDEV.S?

Yes — STDEV is an older function that works the same way as STDEV.S. Excel still supports it for compatibility with older spreadsheets. STDEV.S is the newer name and is preferred, but both produce identical results for sample data.

What happens if I include negative numbers in my formula?

Negative numbers are treated like any other number. Standard deviation measures how spread out your data is, regardless of whether the values are positive or negative. A dataset with values from -10 to 10 will have a larger standard deviation than a dataset with values from 1 to 5.

Can I calculate standard deviation for data in different sheets?

Yes. Reference the other sheet by typing its name followed by an exclamation point: =STDEV.S(Sheet2!A1:A10) calculates standard deviation for cells A1 through A10 on Sheet2. You can combine ranges from multiple sheets in one formula by separating them with commas.

Why does my formula show a different result after I edit it?

Excel recalculates automatically whenever you change a value in your range or modify the formula itself. If you edit a number in one of the cells your formula references, the standard deviation updates immediately. This is normal behavior and helps keep your calculations current.