Standard Dev Formula Excel Guide
In this article
Use the STDEV.S function for a sample or STDEV.P for a population to calculate standard deviation in Excel. You can also use the Data Analysis Toolpak for a full statistical summary. Standard deviation measures how spread out your data points are from the average, essential for analyzing variance and risk.
What You'll Need
- A computer with Microsoft Excel installed (Excel 2010 or later is recommended).
- A dataset containing numerical values. This data can be in a single column, multiple columns, or a single cell as a comma-separated list.
- Basic understanding of the difference between a population and a sample. If you have data for every member of the group you are studying, it is a population. If you have data for only a portion of the group, it is a sample.
Step-by-Step
- Open your Excel workbook. Navigate to the worksheet where your data is located. Ensure your data is clean and organized. For this guide, assume your data is in cells A1 through A20.
- Decide on the function type. You must choose between STDEV.S (Sample) and STDEV.P (Population). As a rule of thumb, if you selected a random subset of data, use STDEV.S. If you are analyzing the entire available data set, use STDEV.P. In Excel 2007 and earlier, these were named STDEV and STDEVP respectively.
- Click on an empty cell. This is where the result of the calculation will appear. It is best practice to place this cell near your data for easy reference.
- Start typing the formula. Type an equals sign (=) to begin the formula. Then, type the name of the function. For a sample standard deviation, type
=STDEV.S(. For a population standard deviation, type=STDEV.P(. - Select your data range. With the formula bar open and the cursor after the opening parenthesis, click and drag your mouse over the cells containing your data. For our example, this would be the range A1:A20. Alternatively, you can simply type the range name manually after the opening parenthesis. Your formula should now look like
=STDEV.S(A1:A20). - Close the parenthesis and press Enter. Type the closing parenthesis () and hit the Enter key on your keyboard. Excel will immediately calculate the standard deviation and display the result in the cell.
- Format the result (optional). By default, Excel displays the result with many decimal places. Depending on your needs, you can right-click the cell, select "Format Cells," and choose "Number" to set a fixed number of decimal places, or "Currency" if you are working with financial data.
Using the Data Analysis Toolpak
If you need more than just the standard deviation—for example, mean, variance, and kurtosis—the Data Analysis Toolpak is a powerful feature. Note that this feature is not always enabled by default in the desktop version of Excel.
- Check if the Toolpak is installed. Go to the "File" tab in the top left, select "Options," and then click "Add-Ins" on the left sidebar. At the bottom of the window, next to "Manage," select "Excel Add-ins" and click "Go." Check the box next to "Analysis Toolpak" and click "OK." If this option is greyed out or missing, you may need to reinstall Microsoft Office to include this component.
- Prepare your data. Ensure your data is in a contiguous range. It is best to have your data in a single column or row without any blank cells in between, as the Toolpak may skip blank rows.
- Open the Analysis Tool. Once installed, go to the "Data" tab in the ribbon. Look for a button labeled "Data Analysis" on the far right. Click this to open the dialog box.
- Select the Descriptive Statistics tool. In the list of available tools, scroll down and select "Descriptive Statistics." Click "OK." This will open a new configuration window.
- Configure the input parameters. In the "Input Range" field, select your data. Check the box for "Labels in first row" if your data has a header. For "Grouped By," select "Columns" or "Rows" depending on how your data is arranged.
- Configure the output options. Choose "Output Range" to display the results on the same sheet, or select "New Worksheet Ply" to create a new tab with the results. Check the box for "Summary statistics" to include the mean, standard deviation, variance, and other metrics.
- Run the analysis. Click "OK." Excel will generate a table containing the standard deviation and a wealth of other statistical information at the specified location.
Common Mistakes
Understanding what not to do is just as important as knowing the correct steps. Here are common errors that can lead to incorrect results or confusing outputs.
Confusing Sample and Population functions. This is the most frequent error. Using the wrong function will give you a result that is mathematically correct for that function but inappropriate for your data type. The population standard deviation (STDEV.P) will always be smaller than the sample standard deviation (STDEV.S) for the same set of numbers. This is because the sample calculation includes a correction factor for the uncertainty of estimating the true population mean.
Including non-numeric data. If your data range includes text, blank cells, or logical values (TRUE/FALSE), Excel will ignore them in the calculation. However, if you accidentally select a cell that contains text and it is part of a number format string (e.g., "$100”), this can cause a #VALUE! error. Always ensure your data is clean and that the cells are formatted as Numbers or Currency, not Text.
Using the wrong range. A common mistake is selecting a range that includes the result cell itself. For example, if you type your formula in cell A21 and select the range A1:A21, the result will be calculated using itself, leading to a circular reference error. Always select a range that is separate from the cell where the formula is being entered.
Ignoring outliers. Standard deviation is highly sensitive to outliers. A single value that is vastly different from the rest of the data can significantly skew the standard deviation. Before reporting standard deviation, it is good practice to visually inspect your data for outliers and decide if they should be included or excluded from the analysis.
Tips
These practical tips will help you use the standard deviation function more effectively and interpret the results with greater confidence.
Visualize your data. Before calculating standard deviation, it is often helpful to create a chart. A simple scatter plot or line chart can reveal patterns, clusters, and outliers that a raw number cannot. If the data points on your chart are tightly clustered around a line, the standard deviation will be low. If the points are scattered far from the line, the standard deviation will be high.
Use named ranges. If you are working with a small, fixed dataset, typing the cell range is fine. However, for larger or more complex workbooks, it is much easier to name your data range. Select your data, go to the "Formulas" tab, and click "Define Name." Give it a descriptive name like "SalesData." Then, in your formula, you can just type =STDEV.S(SalesData). This makes your formulas easier to read and less prone to errors if you insert or delete rows.
Understand the unit of measurement. Remember that standard deviation is expressed in the same units as your original data. If you are measuring heights in centimeters, your standard deviation will also be in centimeters. This consistency makes it easy to compare the standard deviation to the mean to understand the spread. For example, a standard deviation of 5 cm on a mean height of 170 cm is a very different spread than a standard deviation of 5 cm on a mean height of 175 cm.
Combine with other statistics. Standard deviation is rarely used in isolation. It is most powerful when combined with other statistical measures. The coefficient of variation (CV) is calculated by dividing the standard deviation by the mean. This gives you a percentage that allows you to compare the variability of two datasets with different units or different means. This is particularly useful in finance to compare the risk of different assets.
Check for errors before trusting the result. Always double-check the result of your calculation. A result that is unusually high or low, especially for a dataset that you know should be consistent, is a red flag. Verify that you have selected the correct range, that your data is numeric, and that you have used the correct function. If you are using the Data Analysis Toolpak, ensure that the "Summary statistics" box was checked.
Troubleshooting
If your formula is not working as expected, here are the steps to diagnose and fix the problem.
If you see a #NAME? error. This error typically means that Excel does not recognize the function name you typed. Check your spelling carefully. Ensure you are using the correct function name: STDEV.S or STDEV.P. Also, ensure that the Analysis Toolpak is installed if you are trying to access the Data Analysis features.
If you see a #VALUE! error. This error means that one of the arguments in your formula is not a valid number. This often happens if your data range includes text or logical values. Check the cells in your selected range to ensure they are all formatted as numbers. If you have text that looks like numbers (e.g., "100" in a text cell), Excel will not be able to perform the calculation.
If the result is zero. A standard deviation of zero means that every single value in your dataset is identical. If your data is not identical, check your range selection. You may have selected a range that contains only one row or column of data, or you may have selected a range that contains only blank cells. Also, check for hidden rows or columns that might be part of your range but are not visible.
If the result seems too high or too low. If the result is significantly different from what you expected, the most likely cause is the inclusion of outliers. Review your data for any values that are far outside the normal range. If you find an outlier, determine if it is a data entry error. If it is a valid data point, you may need to report the standard deviation with and without that outlier to provide a complete picture.
If the circular reference warning appears. This warning appears if your formula refers to its own cell. For example, if you type =STDEV.S(A1:A22) in cell A22, you will get a circular reference. Excel cannot calculate the value of A22 because it depends on itself. To fix this, select a different cell for your formula, or select a different range that does not include the result cell.
Frequently Asked Questions
What is the difference between STDEV.S and STDEV.P?
STDEV.S calculates the standard deviation for a sample, which is a subset of a population. STDEV.P calculates the standard deviation for an entire population. The difference lies in the denominator of the formula: STDEV.S divides by (n-1), while STDEV.P divides by n. This adjustment for STDEV.S provides an unbiased estimate of the population standard deviation.
Why is my standard deviation negative?
Standard deviation is a measure of spread and is always a non-negative number. If you see a negative result, it is a clear sign of an error. This usually happens if you typed the formula incorrectly, such as =-STDEV.S(A1:A20), or if you are seeing a negative number due to a formatting issue where the cell is set to show negative numbers in red.
How do I calculate the standard deviation of a filtered list?
Standard deviation functions in Excel, such as STDEV.S, do not automatically update based on a filter. To calculate the standard deviation of only the visible rows, you must use the AGGREGATE function. The syntax is =AGGREGATE(5, 6, A1:A20). The number 5 represents the STDEV.S function, and the number 6 tells Excel to ignore hidden rows and error values.
Can I use standard deviation to compare data sets?
Yes, you can compare standard deviations, but it is most meaningful when comparing data sets with the same units and similar means. If you are comparing the variability of two different data sets, it is often better to use the coefficient of variation (CV), which is the standard deviation divided by the mean. This gives you a relative measure of spread that is independent of the units and the mean of the data.
What does a high standard deviation indicate?
A high standard deviation indicates that the data points are spread out over a wider range of values. This means there is a lot of variability or volatility in the data. In financial contexts, a high standard deviation indicates higher risk. In manufacturing, a high standard deviation indicates lower consistency and quality control issues.
What does a low standard deviation indicate?
A low standard deviation indicates that the data points are clustered closely around the mean. This means there is little variability or volatility in the data. In financial contexts, a low standard deviation indicates lower risk. In manufacturing, a low standard deviation indicates high consistency and good quality control.