Standard Deviation Formula in Excel: How to Calculate It
In this article
Excel’s standard deviation formula calculates how spread out values are from the average, helping you understand data variability in surveys, test scores, financial returns, or quality control. You don’t need any add-ins or special setup—just a range of numbers in columns or rows. Use STDEV.S for sample data or STDEV.P for entire populations.
What You'll Need
- Microsoft Excel installed (2010 or later)
- A dataset of numerical values in a column or row
- Clarity on whether your data represents a sample or the full population
Step-by-Step
- Open your Excel workbook and locate the range of cells containing your numerical data. For example, if your data is in cells A1 through A20, note that range.
- Click on an empty cell where you want the standard deviation result to appear. This should be outside your data range to avoid confusion.
- Type
=STDEV.S(if your data is a sample (most common case), or=STDEV.P(if your data represents the entire population. - Highlight the range of cells containing your data with your mouse, or type the range manually. For example, if your data is in A1:A20, type
A1:A20inside the parentheses. The formula should now read=STDEV.S(A1:A20). - Press Enter. Excel will instantly calculate and display the standard deviation value in the selected cell.
- Verify the result by checking that your data range includes only numbers. If any cell contains text, blank, or error values, Excel will ignore them but may cause misleading results if you expected them to be included.
- Optional: To see how the standard deviation changes with different data, edit one or more values in your range and observe the result update automatically.
Common Mistakes
- Using
STDEV.Pwhen you have a sample: This underestimates variability because population formulas assume you have every single data point. Most real-world datasets are samples, so useSTDEV.Sunless you’re certain your data includes every possible observation. - Including non-numeric cells in the range: If your data range accidentally includes headers, text labels, or blank cells, Excel ignores them—but you might think they’re being counted. Always visually confirm your selected range only contains numbers.
- Typing the formula wrong: Common typos include
STDEV(which works in older Excel versions but is deprecated),STDDEV, or missing parentheses. Use onlySTDEV.SorSTDEV.Pin modern Excel. - Not updating the range after adding or deleting rows: If you insert new data below your original range, the formula won’t auto-expand. You must manually update the range in the formula to include new values.
Tips
- Use named ranges for easier maintenance: Select your data, go to the Formulas tab, click Define Name, give it a label like "SalesData", then use
=STDEV.S(SalesData). This makes formulas clearer and automatically adjusts if you add rows within the named range. - Combine with AVERAGE for context: In another cell, type
=AVERAGE(A1:A20)to see the mean. Compare it to the standard deviation—low SD with high mean? Your data is clustered tightly around a high value. - Use conditional formatting to visualize outliers: Select your data range, go to Home > Conditional Formatting > Highlight Cells Rules > Greater Than, and set it to
=AVERAGE(A1:A20)+2*STDEV.S(A1:A20)to highlight values more than two standard deviations from the mean. - Check for data entry errors first: A single typo like 1000 instead of 100 can inflate standard deviation dramatically. Sort your data to spot anomalies before calculating.
- For multiple data sets, use array formulas: If you have multiple columns (e.g., sales by region), you can calculate standard deviation for each using
=STDEV.S(B1:B20),=STDEV.S(C1:C20), etc., or use a pivot table with standard deviation as a value field.
Troubleshooting
- Formula returns #DIV/0!: This means Excel found fewer than two numeric values in your range. Standard deviation requires at least two data points. Check if your range is empty, contains only one number, or all values are text.
- Formula returns #VALUE!: One or more cells in the range contain text that can’t be interpreted as a number. Use Find and Replace (Ctrl+H) to locate and correct text entries like "N/A", "missing", or "$1,000" (remove the dollar sign).
- Result seems too high or too low: Recheck your selection. Did you accidentally include headers? Is your data in the wrong column? Try selecting the range manually instead of typing it. Also confirm you’re using
STDEV.Sfor samples andSTDEV.Pfor populations. - Formula doesn’t update when I change data: Ensure calculation is set to Automatic. Go to Formulas > Calculation Options > Automatic. If it’s set to Manual, press F9 to recalculate.
- Seeing #NAME?: You’ve misspelled the function. Double-check for typos like "STDEV.S" vs. "STDEV.S()" or "STDEV.S" vs. "STDEV". Only use the exact function names supported in your version.
Frequently Asked Questions
What’s the difference between STDEV.S and STDEV.P?
STDEV.S calculates standard deviation for a sample of a larger group, using n-1 in the denominator to correct for bias. STDEV.P assumes your data is the entire population and uses n. Use STDEV.S unless you have every possible data point.
Can I calculate standard deviation for non-numeric data?
No. Excel ignores text, logical values, or empty cells in standard deviation formulas. You must convert or clean your data to numeric values first.
Does Excel handle negative numbers in standard deviation?
Yes. Standard deviation measures spread, not direction. Negative numbers are treated the same as positive ones—only the distance from the mean matters.
Why is my standard deviation zero?
It means all your data points are identical. Every value equals the mean. This can indicate a data collection error or that your variable has no variation.
Can I use standard deviation with dates or times?
Yes, if stored as serial numbers (Excel’s default). Excel treats dates and times as numbers, so STDEV.S will calculate variability in days or fractions of a day. Format the result as a number to interpret it correctly.
Is there a keyboard shortcut to insert the standard deviation formula?
No direct shortcut, but you can type "=stdev" and press Tab—Excel will auto-complete to STDEV.S if it’s the most likely match. Use the Insert Function button (fx) next to the formula bar for a guided selection.