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

Standard deviation measures how spread out numbers are from the average in a dataset. In Excel, you can quickly calculate it using built-in functions—no manual math required. To get started, ensure your data is entered in a single column or row with no text or blank cells mixed in, as this can cause errors.

What You'll Need

  • Microsoft Excel (any recent version: Excel 2010, 2013, 2016, 2019, 2021, or Microsoft 365)
  • A dataset of numerical values entered into a worksheet (e.g., test scores, sales figures, sensor readings)
  • Clarity on whether your data represents a sample or the entire population (this determines which function to use)

Step-by-Step

  1. Open your Excel workbook and locate the worksheet containing your data. Arrange your numbers in a single column (e.g., A2 to A20) or row (e.g., A1 to J1), keeping the range consistent and free of non-numeric entries.
  2. Click an empty cell where you want the standard deviation result to appear (e.g., D2). This cell will hold your formula.
  3. Type one of the following formulas, depending on your data type:
    • For a sample (e.g., 30 students out of 500): =STDEV.S(range) — for Excel 2010 and newer. Example: =STDEV.S(A2:A20)
    • For the entire population (e.g., all 500 students): =STDEV.P(range) — for Excel 2010 and newer. Example: =STDEV.P(A2:A501)
    If you're using Excel 2007 or earlier, use =STDEV(range) for samples and =STDEVP(range) for populations instead.
  4. Replace range with your actual cell range. You can do this manually by typing (e.g., A2:A20) or click and drag over the cells after typing the opening parenthesis.
  5. Press Enter on your keyboard. Excel immediately calculates and displays the standard deviation in the selected cell. If you used =STDEV.S and your data is a sample, the result is the sample standard deviation; if you used =STDEV.P, it's the population standard deviation.
  6. Optionally, verify your result by comparing with the mean. Click another cell, type =AVERAGE(range), and press Enter. Then subtract the mean from each data point, square the result, sum those squares, divide by n-1 (for sample) or n (for population), and take the square root—but Excel handles this automatically, so this step is for validation only.

Common Mistakes

  • Using STDEV.S for population data (or STDEV.P for sample data). Sample functions divide by n-1 (Bessel's correction), while population functions divide by n. Mixing them up inflates or deflates the result.
  • Including non-numeric cells (e.g., text like "N/A" or empty cells) in the range. Excel ignores text and blanks, but if your range includes logical values (TRUE/FALSE), STDEV.S and STDEV.P treat TRUE as 1 and FALSE as 0—which may skew results.
  • Accidentally including headers in the range. If cell A1 contains "Score" and your formula is =STDEV.S(A1:A20), Excel treats "Score" as 0, causing a large, incorrect standard deviation.
  • Using the wrong syntax, such as =STDEV.S A2:A20 (missing parentheses) or =STDEV.S(A2,A20) (comma separates only two values, not a range).

Tips

  • Use named ranges for clarity. Select your data, go to the Formula bar, type "Scores" in the Name Box (left of the formula bar), and press Enter. Then use =STDEV.S(Scores) instead of cell references.
  • For dynamic ranges (e.g., data grows weekly), convert your dataset to an Excel Table (select data > Insert > Table). Then reference the column header in your formula: =STDEV.S(Table1[Score]).
  • Check for outliers first. Standard deviation is sensitive to extreme values. Run =MIN(range) and =MAX(range) to spot anomalies before calculating.
  • Use conditional formatting to visualize spread: select your data, Home > Conditional Formatting > Color Scales > Red-Yellow-Green. This helps confirm if your standard deviation makes sense visually.
  • If you need standard error (standard deviation / √n), add =STDEV.S(A2:A20)/SQRT(COUNT(A2:A20)).

Troubleshooting

If Excel returns an error or unexpected result, follow these steps:

  • #DIV/0! appears: This means your range has only one numeric value (standard deviation requires at least two data points). Add more data or check for typos.
  • #VALUE! appears: A non-numeric value is in the range. Press Ctrl+F to search for text, or use Filter (Data > Filter) to isolate non-numeric entries.
  • The result seems too large or small: Double-check whether you’re using STDEV.S (sample) or STDEV.P (population). Re-run the calculation with the other function to compare.
  • Formula displays as text instead of calculating: Ensure the cell isn’t formatted as Text. Right-click the cell > Format Cells > Number > Decimal > OK, then re-enter the formula.
  • Results differ from another tool (e.g., Google Sheets or a calculator): Confirm the tool uses the same method. Some calculators default to population standard deviation; Excel defaults to sample unless you specify .P.

Frequently Asked Questions

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

STDEV.S calculates the standard deviation for a sample of a population and uses n-1 in the denominator (Bessel’s correction) to reduce bias. STDEV.P calculates for the entire population, dividing by n. Use STDEV.S unless your data includes every possible observation.

Can I calculate standard deviation for non-contiguous cells?

Yes. Separate cell references with commas inside the function: =STDEV.S(A2,A5,A8,A12). You can also combine ranges: =STDEV.S(A2:A5,C2:C5).

How do I handle blank cells in my range?

Excel’s STDEV.S and STDEV.P automatically ignore blank cells and text. However, if a cell contains 0, it’s included as a valid value. To exclude zeros, use =STDEV.S(IF(A2:A20<>0,A2:A20)) as an array formula (press Ctrl+Shift+Enter in older Excel versions; in Excel 365, it auto-accepts).

Why does my standard deviation change when I add more data?

Standard deviation reflects variability in your current dataset. Adding more data points—especially outliers—changes the average and spread, so the result naturally shifts. This is expected behavior.

Can I use standard deviation with text-based data (e.g., product codes)?

No. Standard deviation only applies to numerical data. Text values (like "Product-A") have no numeric meaning and will be ignored. Convert to numbers first (e.g., using a lookup table) if needed.

Is there a way to calculate standard deviation by group (e.g., by region)?

Yes. Use STDEV.S with a filter: sort or filter your data by group, then apply the formula to the visible cells only. Alternatively, use STDEV.S combined with SUBTOTAL in a helper column, or upgrade to Excel 365 and use =STDEV.S(FILTER(B2:B100,A2:A100="North")) to filter dynamically by category.