Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Calculate Standard Deviation in Excel

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Calculating standard deviation in Excel measures how spread out data points are from the mean, helping assess variability and risk in datasets—essential for finance, science, and quality control. Excel provides built-in functions for both sample and population standard deviation, so you only need your data entered in a worksheet and basic familiarity with cell references.

What You'll Need

  • A Windows or Mac computer with Microsoft Excel installed (Excel 2010 or later)
  • A dataset entered into a single column or row (e.g., A1:A20)
  • No add-ins or special permissions required

Step-by-Step

  1. Open your Excel workbook and ensure your data is clean: remove blank cells, text, or errors in the range you plan to analyze. Standard deviation only works with numeric values.
  2. Decide whether your data represents a sample or the entire population. If you're analyzing a subset (e.g., 100 test scores from a school of 5,000), use the sample standard deviation function (STDEV.S or STDEV). If you have data for every member (e.g., all 5,000 students), use the population function (STDEV.P).
  3. Select an empty cell where you want the result to appear—ideally near your data, like cell B2 if your data is in A2:A51.
  4. Enter the correct function. For sample standard deviation in modern Excel (2010+), type =STDEV.S(A2:A51) (replace A2:A51 with your actual range). For population standard deviation, type =STDEV.P(A2:A51).
  5. Press Enter. Excel instantly calculates and displays the standard deviation value. For example, if your data in A2:A6 is 10, 12, 14, 16, 18, =STDEV.S(A2:A6) returns approximately 3.16, while =STDEV.P(A2:A6) returns 2.83.
  6. Verify the result by checking the formula bar—you should see your function, not just the number. You can also click the cell and look for the green calculation icon that appears when hovering over the cell.

Common Mistakes

  • Using STDEV.P when you have a sample: this underestimates variability and is statistically incorrect. Always confirm your data scope first.
  • Including text, logical values (TRUE/FALSE), or empty cells in the range: STDEV.S and STDEV.P ignore them, but STDEV (legacy) and STDEVA (which includes text as 0) may cause errors if misapplied.
  • Accidentally referencing the wrong range—e.g., A1:A20 instead of A2:A21—leading to inclusion of headers or exclusion of data points. Double-check the cell references in the formula bar.
  • Using commas instead of periods in decimal numbers on non-US systems, which Excel may misinterpret. Ensure your regional settings match your data format.
  • Confusing standard deviation with standard error: SD measures data spread; standard error measures how precisely the sample mean estimates the population mean (SD divided by √n).

Tips

  • Use named ranges for frequently analyzed columns: select your data, go to the Formulas tab > Define Name, type "SalesData", then use =STDEV.S(SalesData) for clarity and easier updates.
  • For interactive dashboards, link the range to a cell (e.g., B1 contains "=A2:A51" dynamically via offset functions), but note STDEV.S won’t auto-update with dynamic arrays—use FILTER or INDEX for robust dynamic ranges.
  • Combine with AVERAGE to contextualize: add =AVERAGE(A2:A51) in one cell and =STDEV.S(A2:A51) next to it; then calculate coefficient of variation (CV) as =STDEV.S(range)/AVERAGE(range) for relative variability.
  • Use conditional formatting to highlight cells beyond ±2 standard deviations: select your data, Home > Conditional Formatting > New Rule > Use a formula, enter =ABS(A2-AVERAGE($A$2:$A$51))>2*STDEV.S($A$2:$A$51), and set a fill color.
  • On Mac, the functions are identical, but access them via the Function Library on the Formulas tab > More Functions > Statistical.

Troubleshooting

If you get a #DIV/0! error, check that your range contains at least two numeric values—STDEV.S and STDEV.P require at least two data points to calculate (one point has zero variability). If you see #NAME?, ensure you typed the function name correctly: Excel 2007 and earlier lack STDEV.S, so use STDEV instead. Verify spelling and avoid extra spaces in the formula (e.g., =STDEV.S( A2:A51 ) may trigger errors).

If the result seems implausibly small or large, inspect your data for outliers or entry errors. Select the range, press Ctrl+G > Special > Blanks to find empty cells, or use Data > Filter to spot extreme values. Also confirm you didn’t accidentally include negative signs or text like "N/A"—use Filter to exclude non-numeric entries before recalculating.

For large datasets, enable automatic calculation: File > Options > Formulas > Calculation options > Automatic. If it’s set to Manual, press F9 to force recalculation after updating data.

Frequently Asked Questions

What’s the difference between STDEV.S and STDEV.P?

STDEV.S calculates standard deviation for a sample (uses n−1 in the denominator for unbiased estimation), while STDEV.P uses n (population formula). Use STDEV.S for most real-world analyses where data is a subset.

Can I calculate standard deviation for non-contiguous cells?

Yes—separate ranges with commas inside the function, like =STDEV.S(A1:A10,C1:C10). Ensure all ranges contain only numbers; mixed data types may cause #VALUE! errors.

Why does Excel show #NUM!?

This usually means your data includes numbers too large for Excel’s calculation limits (over 10^308). Check for erroneous entries like 9E+307 or text misformatted as numbers. Convert text to numbers via Data > Text to Columns.

How do I calculate standard deviation by group (e.g., per category)?

Use STDEV.S with a filter: apply a filter to your data (Data > Filter), then use =SUBTOTAL(104,range) where 104 is STDEV.S for filtered ranges. Or in Excel 365, use =STDEV.S(FILTER(B:B,A:A="Category")).

Does Excel use sample or population by default?

Legacy STDEV (pre-2010) uses sample. STDEV.S ( Excel 2010+) explicitly uses sample. STDEV.P explicitly uses population. Always check the function name—don’t assume based on old tutorials.

Can I use standard deviation with pivot tables?

Pivot tables don’t include standard deviation by default. Add it by right-clicking a value field > Value Field Settings > choose "StdDev" (sample) or "StdDevp" (population) from the list. Note: this calculates SD of the underlying data, not of aggregated sums.