STDEV.P vs STDEV.S: Standard Deviation for Population vs Sample

STDEV.P vs STDEV.S Standard Deviation for Population vs Sample
Learn when to use STDEV.S and STDEV.P in Excel. This tutorial blog covers Bessel’s correction, quality control, financial volatility, z-scores, rolling standard deviation, and 8 practical examples with formulas. Explore other tutorials to learn more about Excel Functions.

You have a column of numbers and you need the standard deviation. Excel gives you two main choices: STDEV.S and STDEV.P. Most people pick one and hope it is right. The difference is not cosmetic — it changes the result, and the wrong choice can produce misleading conclusions in quality control, financial analysis, and scientific reporting. This guide explains exactly when to use each function and why.

Standard deviation measures how spread out your data is. Specifically, it quantifies average distance from the mean. A low standard deviation means values cluster tightly around the mean. A high standard deviation means they spread widely. The two Excel functions produce different results because they divide by different denominators: STDEV.S divides by n−1 (the sample size minus one), while STDEV.P divides by n (the total count). This single difference has a meaningful statistical justification.

Availability: STDEV.S and STDEV.P are available in Excel 2010 and all later versions, including Microsoft 365, Excel 2024, 2021, 2019, and 2016. They also work in Google Sheets. The legacy STDEV and STDEVP functions are still available but STDEV.S and STDEV.P are the recommended modern equivalents.

What Is Standard Deviation?

Standard deviation is the average distance between each data point and the mean. It is expressed in the same units as the original data, which makes it directly interpretable. For example, a standard deviation of £500 on a salary dataset means most salaries are within £500 of the average. A standard deviation of £15,000 indicates far greater variation.

The calculation involves four steps, and the distinction between the two functions appears in step four. First, find the mean. Second, subtract the mean from each value and square the result. Third, sum all the squared differences. Fourth, divide by n or n−1 and take the square root. The only difference between STDEV.S and STDEV.P is in step four — and that difference is the entire subject of this article.

What Is the Difference Between STDEV.S and STDEV.P?

The distinction comes down to whether your data represents the entire group (a population) or just a subset (a sample). Use STDEV.S when your data is a sample drawn from a larger population. Use STDEV.P only when your data is the complete population — every single member, with none missing.

FeatureSTDEV.SSTDEV.P
Divides byn−1 (Bessel’s correction)n (total count)
Use whenData is a sample from a larger populationData IS the entire population
ResultSlightly larger — corrects for sampling biasSlightly smaller — no bias correction
Legacy functionSTDEV (identical results)STDEVP (identical results)
MatchesR sd(), Python std(ddof=1), most statistical software defaultsR sd() with ddof=0, Python std(ddof=0), NumPy default
Most common choiceYes — appropriate for most real-world analysisOnly when the dataset is truly complete
The practical rule: If you collected data from a subset of a group — a survey, a batch sample, a test group, a month of transactions — use STDEV.S. If your data covers every single member of the group with no exceptions — every employee, every product in a production run, every student in the class — use STDEV.P. When in doubt, STDEV.S is the safer choice.

Why Does n−1 Exist in STDEV.S?

Dividing by n−1 instead of n is called Bessel’s correction. This adjustment exists for a specific statistical reason. It exists because sample data tends to underestimate the true population spread. When you draw a sample, the values you observe are typically closer to the sample mean than to the true population mean. Dividing by a slightly smaller number (n−1) inflates the result just enough to correct for this systematic underestimation.

The effect is most pronounced on small samples. For instance, on n=5 the result increases by about 12%. For a sample of five values, dividing by 4 instead of 5 increases the result by about 12%. For a sample of 100 values, the difference is less than 1%. Consequently, on large datasets STDEV.S and STDEV.P produce nearly identical results. The choice still matters for correctness, but the numerical impact shrinks as n grows.

What Is the Syntax for Both Functions?

=STDEV.S(number1, [number2], ...) =STDEV.P(number1, [number2], ...)
ArgumentRequired?What it does
number1RequiredThe first number, range, or array. Typically a cell range like A2:A100. Text and logical values are ignored. Zeros are included.
number2, ...OptionalAdditional numbers or ranges. Up to 255 arguments total. All values are pooled before the standard deviation is calculated.

Examples 1–4: Core Standard Deviation Calculations

1
Side-by-side comparison — how the two functions differ numerically

The best way to see the difference is to run both functions on the same small dataset. With only five values, the gap between STDEV.S and STDEV.P is clearly visible. As n grows, the gap narrows. This example uses exam scores from five students.

A2
A3
A4
A5
A6
STDEV.S
STDEV.P
72
85
91
68
79
9.49
8.49
Dataset: {72, 85, 91, 68, 79} — five exam scores. n = 5, mean = 79. STDEV.S — treats these as a sample, divides by n−1 = 4: =STDEV.S(A2:A6) → 9.49 STDEV.P — treats these as the full population, divides by n = 5: =STDEV.P(A2:A6) → 8.49 The difference: 9.49 vs 8.49 — about 12% on a sample of 5. On a sample of 100, the gap shrinks to under 1%. Verify: STDEV.S matches the legacy STDEV function exactly. =STDEV.S(A2:A6) = STDEV(A2:A6) → TRUE =STDEV.P(A2:A6) = STDEVP(A2:A6) → TRUE
2
Quality control — STDEV.P for a complete production batch

In manufacturing, a production batch is the entire population. Specifically, every item in the batch is measured. Every item in the batch is measured — nothing is left out. Because no sampling is involved, STDEV.P is correct here. The result feeds directly into process capability calculations such as Cp and Cpk, which compare the standard deviation to specification limits.

A2:A500 holds measurements for every item in the production batch. This IS the full population — no items are excluded from measurement. Therefore STDEV.P is correct. Batch standard deviation (full population): =STDEV.P(A2:A500) → Population standard deviation for this batch Process capability index Cp — compares spread to spec limits. USL = upper spec limit (e.g. D2). LSL = lower spec limit (e.g. D3). Cp = (USL − LSL) / (6 × standard deviation). A Cp above 1.33 indicates a capable process. $D$2 - $D$3) / (6 * =STDEV.P(A2:A500)) → Cp index for the batch Control limits for a quality chart — mean ± 3σ: D4 = batch mean = AVERAGE(A2:A500) D5 = batch STDEV.P = STDEV.P(A2:A500) Upper control limit (UCL): $D$4 + 3 * $D$5 Lower control limit (LCL): $D$4 - 3 * $D$5
3
Survey analysis — STDEV.S for a sample of respondents

Consider a customer satisfaction survey that reaches 200 respondents from a customer base of 50,000. The 200 scores are a sample — not the full population. To draw valid conclusions about all 50,000 customers, use STDEV.S. The n−1 correction makes the estimate more conservative and reduces overconfidence when inferring from a subset to the whole.

A2:A201 holds survey scores from 200 respondents. The customer base has 50,000 members — this data is a sample. Use STDEV.S to estimate the population standard deviation from the sample. Sample standard deviation (infer population from sample): =STDEV.S(A2:A201) → Estimated standard deviation of satisfaction scores across all 50,000 customers Standard error of the mean — how reliable is the sample mean? Standard error = STDEV.S / SQRT(n). Smaller standard error means the sample mean is a more precise estimate. =STDEV.S(A2:A201) / SQRT(COUNT(A2:A201)) → Standard error of the mean score 95% confidence interval for the population mean: Mean ± 1.96 × standard error. D2 = sample mean, D3 = standard error. Lower bound: $D$2 - 1.96 * $D$3 Upper bound: $D$2 + 1.96 * $D$3
4
Coefficient of variation — comparing spread across different scales

Standard deviation is expressed in the same units as the data, which is useful for direct interpretation. This makes comparing standard deviations across different metrics difficult — a standard deviation of 10 means something very different for a dataset with a mean of 20 versus a mean of 10,000. The coefficient of variation (CV) solves this by expressing spread as a percentage of the mean.

Coefficient of variation = standard deviation / mean × 100. A CV of 15% means the spread is 15% of the average value. Use STDEV.S for samples (most financial and business datasets). CV for a sample dataset (relative spread expressed as a percentage): =STDEV.S(A2:A100) / AVERAGE(A2:A100) * 100 → Spread as a percentage of the mean (dimensionless) Compare CV across two assets — which has more relative volatility? A2:A100 = Asset 1 returns, B2:B100 = Asset 2 returns. Lower CV = lower relative risk per unit of return. Asset 1 CV: =STDEV.S(A2:A100) / AVERAGE(A2:A100) * 100 Asset 2 CV: =STDEV.S(B2:B100) / AVERAGE(B2:B100) * 100 Display as a formatted percentage cell: Format the cell as Percentage with 1 decimal place. Alternatively, wrap in TEXT for a fixed label. TEXT(=STDEV.S(A2:A100) / AVERAGE(A2:A100), "0.0%") → "14.3%"

Examples 5–8: Applied Scenarios

Finance, HR, and Academic Applications

5
Financial volatility — annualised standard deviation of returns

In finance, standard deviation of returns is the standard measure of volatility. Furthermore, it is the denominator in the Sharpe ratio. Monthly or daily return data is a sample — a subset of all possible future returns. Consequently, STDEV.S is correct. To compare annual volatility across assets measured at different frequencies, multiply by the square root of the number of periods per year.

A2:A61 holds 60 months of monthly returns for a fund (5 years of data). This is a sample — not all possible future months. Use STDEV.S. Monthly standard deviation (sample): =STDEV.S(A2:A61) → Monthly standard deviation of returns Annualised standard deviation — multiply by SQRT(12) for monthly data: This converts monthly volatility to an annualised figure for comparison. =STDEV.S(A2:A61) * SQRT(12) → Annualised volatility (compare across funds on a like-for-like basis) For daily return data — multiply by SQRT(252) (trading days per year): A2:A253 = 252 daily returns (one trading year). =STDEV.S(A2:A253) * SQRT(252) Sharpe ratio — return per unit of risk: D2 = mean monthly return, D3 = risk-free rate / 12, D4 = monthly STDEV.S. Annualise both numerator and denominator before dividing. ($D$2 - $D$3) * 12 / ($D$4 * SQRT(12)) → Annualised Sharpe ratio
6
HR compensation spread — salary dispersion within a grade

A compensation analyst reviewing salaries for one job grade typically has data for every employee in that grade. Consequently, the dataset is a population. That makes it a population, not a sample — so STDEV.P is correct. However, if the goal is to benchmark against an external salary survey that used a sample of companies, switch to STDEV.S. The choice depends on whether the data represents the full group or a subset.

Scenario A: All 47 employees in Grade 5 — this IS the complete population. STDEV.P is correct because nothing is being inferred from a sample. =STDEV.P(A2:A48) → True spread of salaries within this complete grade population Scenario B: 80 respondents from an external market salary survey. These 80 represent a sample of the broader market. Use STDEV.S. =STDEV.S(B2:B81) → Estimated spread of market salaries across all companies in the sector Salary spread summary — mean ± 1 standard deviation range: D2 = mean, D3 = STDEV.P (internal population). Low range (−1σ): $D$2 - $D$3 High range (+1σ): $D$2 + $D$3 → About 68% of employees fall within this range (under a normal distribution)
7
Z-score — how many standard deviations from the mean?

A z-score tells you how many standard deviations a specific value sits above or below the mean. It is therefore a dimensionless measure of relative position. It standardises values from different scales onto a single comparable axis. Use the same function for the z-score denominator as you would for reporting the standard deviation — STDEV.S for samples, STDEV.P for populations.

Name
Score
Z-score (sample)
Interpretation
Alice
92
+1.37
1.4σ above mean
Bob
71
−0.75
0.75σ below mean
Z-score formula: z = (value − mean) / standard deviation. B2 = individual score. $B$2:$B$100 = full score range (absolute ref). Z-score using STDEV.S (for a sample of students): Use $B$2:$B$100 so the range stays fixed when copying down rows. (B2 - AVERAGE($B$2:$B$100)) / =STDEV.S($B$2:$B$100) → +1.37 for a score 1.37 standard deviations above the mean Z-score using STDEV.P (for a complete class population): Use STDEV.P when every student in the group is represented. (B2 - AVERAGE($B$2:$B$100)) / =STDEV.P($B$2:$B$100) Flag values more than 2σ from the mean (statistical outliers): ABS converts the z-score to positive for threshold comparison. =IF(ABS((B2-AVERAGE($B$2:$B$100))/=STDEV.S($B$2:$B$100))>2, "Outlier", "Normal")
8
Rolling standard deviation — tracking volatility over time

A rolling standard deviation calculates the spread over a moving window of recent periods, which is useful for tracking change over time. This is widely used in financial dashboards to show whether volatility is increasing or decreasing over time. Each row looks back a fixed number of periods — for example, the last 12 months. Because each window is a sample of recent data, STDEV.S is appropriate.

A2:A100 = monthly return data ordered chronologically (A2 = oldest). B13 onwards = rolling 12-month standard deviation (needs 12 rows of history). Use OFFSET to define a moving window of exactly 12 values. Rolling 12-period STDEV.S — paste in B13, copy down: =STDEV.S(OFFSET(A2, ROW()-14, 0, 12, 1)) → Standard deviation of the 12 months ending on this row Simpler version — use a direct range when rows are fixed: B13 = STDEV.S(A2:A13), B14 = STDEV.S(A3:A14) etc. This is clearer but requires manual adjustment if the window changes. Alternative with INDIRECT — build the range address as a string: ROW()-12 gives the start row, ROW()-1 gives the end row. =STDEV.S(INDIRECT("A"&(ROW()-12)&":A"&(ROW()-1))) → Same result — readable and easier to adjust the window size
Annualise a rolling monthly standard deviation by multiplying by SQRT(12). This converts the rolling window result to a comparable annual volatility figure, directly matching how fund managers and analysts report risk.

Common Issues and How to Fix Them

Which function should I use if I am not sure?

Use STDEV.S as your default in almost every scenario. Most datasets in business, finance, and research are samples — they represent a subset drawn from a larger group. The n−1 correction in STDEV.S produces a more conservative and statistically unbiased estimate. Use STDEV.P only when you are certain the data covers every member of the population with no omissions.

STDEV gives a different result to what I expect

First, check whether the range contains blank cells, text values, or zeros that should not be included. STDEV.S ignores text and blanks but includes zeros. Additionally, confirm whether your data uses STDEV.S or STDEV.P relative to what external tools report. R’s sd() function uses n−1 (matching STDEV.S). Python’s NumPy std() uses n by default (matching STDEV.P), while Pandas std() uses n−1 (matching STDEV.S).

The standard deviation is zero

A zero result means every value in the range is identical. Additionally, check that the correct range is referenced. Check that the correct range is referenced and that the data has not been accidentally rounded or truncated to remove variation. STDEV.S with only one value returns a #DIV/0! error because dividing by n−1 = 0 is undefined. STDEV.P with one value returns zero. Both are correct for their respective scenarios.

Avoid the legacy STDEV and STDEVP functions: The functions STDEV and STDEVP are still available in Excel for backward compatibility, but Microsoft has not updated them since Excel 2010. They produce identical results to STDEV.S and STDEV.P respectively, but their names do not communicate whether the calculation is for a sample or a population. Use STDEV.S and STDEV.P in all new workbooks for clarity.

Frequently Asked Questions

  • What is the difference between STDEV.S and STDEV.P?+
    STDEV.S calculates the sample standard deviation by dividing by n−1. STDEV.P calculates the population standard deviation by dividing by n. Use STDEV.S when your data is a sample drawn from a larger population — a survey, a batch sample, or any subset. Use STDEV.P only when your data represents the entire population with no values excluded. STDEV.S is correct for most real-world datasets. The difference in results is most significant on small samples — on large datasets the two values converge.
  • Why does STDEV.S divide by n−1 instead of n?+
    This is Bessel’s correction. Sample data tends to cluster closer to the sample mean than to the true population mean. As a result, dividing by n systematically underestimates the true population variance. Dividing by n−1 inflates the result just enough to correct for this bias. The correction produces an unbiased estimator of the population variance when the data is a random sample — which is almost always the case in practice. For large n, the difference between n and n−1 becomes negligible.
  • Is STDEV the same as STDEV.S?+
    Yes — STDEV and STDEV.S produce identical results. STDEV is the legacy function from Excel versions before 2010. Microsoft introduced STDEV.S (and STDEV.P) to make the sample vs. population distinction explicit in the function name. STDEV remains available for backward compatibility but STDEV.S is recommended for all new workbooks. Similarly, STDEVP and STDEV.P are identical — use STDEV.P going forward.

More Questions About Standard Deviation

  • When should I use STDEV.P instead of STDEV.S?+
    Use STDEV.P specifically when your dataset IS the entire population — not a sample drawn from it. Practical examples include: all students in a single class (not a sample of students from all classes), every item produced in a specific manufacturing batch, all employees in a department, or all transactions in a closed fiscal period where nothing was excluded. If even one member of the population was not measured or included, the data is a sample and STDEV.S is correct.
  • What is the difference between STDEV.S and STDEV.A?+
    STDEV.A is the “A” (all values) variant of the sample standard deviation. It differs from STDEV.S in how it handles text and logical values. STDEV.S ignores text strings and TRUE/FALSE values in the range entirely. STDEV.A counts logical TRUE as 1 and FALSE as 0, and converts text strings to 0. For most numeric datasets these functions return the same result. Use STDEV.A only when you specifically need logical values or text-as-zero included in the calculation.
  • How do I calculate standard deviation for a filtered or conditional range?+
    STDEV.S and STDEV.P do not support conditional filtering natively — they operate on a fixed range. For conditional standard deviation, combine them with IF in an array formula. In Excel 365, enter =STDEV.S(IF(B2:B100="North", A2:A100)) normally. In Excel 2019 and earlier, press Ctrl+Shift+Enter to confirm it as an array formula. Alternatively, use a helper column to filter the values and then run STDEV.S on the filtered column.