Excel gives you six standard deviation functions, and picking the wrong one is the most common error. Type =STDEV.S(A2:A101) for a sample, =STDEV.P(A2:A101) for a full population, and you're done in seconds. The rest of this article covers which function fits your data, why Excel's older STDEV still exists, and how to avoid the mistakes that quietly produce wrong numbers.
Six Functions, One Decision: Which Standard Deviation Belongs to Your Data
The choice comes down to a single question: does your range contain every member of the group, or a subset meant to represent a larger one? Excel labels the answer with .S for sample and .P for population. A sample of 30 customer wait times gets STDEV.S; all 30 employees in one department gets STDEV.P. The function names carry the distinction directly, so you never have to remember a mnemonic.
Here's the part most tutorials skip: Excel also keeps three legacy functions β STDEV, STDEVP, and STDEVPA β for backward compatibility. Microsoft's own documentation states that STDEV.S and STDEV.P are the modern replacements and that the legacy versions exist only so older workbooks keep calculating. New spreadsheets should use the .S and .P versions, which also appear in Excel's autocomplete and function wizard.
The six functions split three ways. STDEV.S, STDEV, and STDEVA all estimate standard deviation from a sample; STDEV.P and STDEVP calculate it for an entire population; STDEVPA does the population calculation while treating text and logical values as numbers. That last trio matters only when your range holds TRUE, FALSE, or text entries mixed with numbers.
If you're unsure which you have, ask who collected the data. Measurements taken on everything that exists β every invoice for the year, every machine on the floor β are population data. Anything sampled from a larger pool, like 200 of 5,000 orders, is a sample. When in doubt, use STDEV.S; it's the more conservative choice because the sample formula divides by nβ1 rather than n, producing a slightly larger, safer figure.
The Sample Formula Divides by nβ1, and That Changes Your Answer
Excel's sample standard deviation divides the squared deviations by one less than the count. With ten values, STDEV.S divides by 9 while STDEV.P divides by 10. That single difference makes the sample result larger, and the gap widens as your dataset shrinks. It's not a rounding quirk; it's a correction that accounts for estimating a population from limited data.
A worked example makes the size of the gap concrete. For the five values 2, 4, 4, 4, 5, 5, 7, 9 β a classic eight-point set β the mean is 5, and the squared deviations sum to 32. Dividing by 8 gives a population variance of 4 and a population standard deviation of exactly 2. Dividing by 7 gives a sample variance of about 4.571 and a sample standard deviation of about 2.138. Same data, two legitimate answers, differing by nearly 7 percent.
Scale that up and the difference nearly vanishes. At 100 values the divisor is 99 versus 100, a gap of roughly 0.5 percent in the variance and about 0.25 percent in the standard deviation. The choice becomes critical in small quality-control batches, pilot studies, and classroom-sized datasets β exactly where people forget to think about it.
Excel's legacy STDEV function returns the same result as STDEV.S, which is why old templates still work. The trap is assuming STDEV means "the standard one" rather than "the sample one." It has always been the sample calculation. Microsoft kept it unchanged for compatibility, not because it's a general-purpose default.
Standard Deviation in Excel: Three Ways to Get the Number
Three routes cover nearly every situation: the function, the Analysis ToolPak, and a quick manual check. The function route is fastest for a single column. The ToolPak produces a full descriptive-statistics table in one dialog. The manual route exists so you can verify Excel's output when a result looks suspicious.
1: Click an empty cell where the result should appear, ideally below or beside your data column. 2: Type =STDEV.S( β Excel's autocomplete will list the function as you type. 3: Select your range with the mouse, or type it directly, such as A2:A101. Include the parentheses: =STDEV.S(A2:A101). 4: Press Enter. The cell shows the sample standard deviation, typically with many decimal places. 5: Format the result with Ctrl+1 (Format Cells), choose Number, and set decimal places to match your reporting standard. 6: For a population figure, repeat with =STDEV.P(A2:A101) in a separate cell so you can compare both.
If the formula returns #DIV/0!, your range has fewer than two numeric values and Excel cannot compute a sample deviation. An #VALUE! error usually means the range contains text that Excel tried to interpret as a number. Check for stray labels, spaces, or numbers stored as text β the green triangle in the corner of a cell flags that last case.
For the ToolPak route, enable it once through File > Options > Add-ins > Analysis ToolPak, then open Data > Data Analysis > Descriptive Statistics. Tick "Summary statistics" and Excel returns mean, standard error, median, mode, standard deviation, variance, kurtosis, skewness, range, minimum, maximum, sum, and count in a fresh output block. It reports the sample deviation, and it does not offer the population version β a gap you should know about before trusting the table for a full-population figure.
The manual check uses two helper columns: one for each value minus the mean, one for that difference squared. Average the squared column and take the square root. That average matches STDEV.S only if you average with nβ1 in the denominator, and matches STDEV.P if you use n. Building this once teaches you what the function is actually doing and gives you a reliable audit trail.
Text, Blanks, and the STDEVA Trap in Real Spreadsheets
Real data is rarely a clean column of numbers. Customer records carry "N/A" entries, survey exports include blank rows, and manually typed sheets contain a stray "TBD." Each function family handles these differently, and the difference can swing your result by a wide margin on small datasets.
STDEV.S and STDEV.P count only numbers. Text, logical values, and empty cells are ignored entirely, so a column with three blanks and 47 numbers calculates on 47 values. That's almost always what you want. The A variants β STDEVA and STDEVPA β count logical values and text representations of numbers, treating TRUE as 1, FALSE as 0, and text as 0. A single FALSE in a 20-value range drags the deviation downward, because Excel has just added a zero to your dataset.
Here's the failure scenario worth memorizing. A quality team tracks 15 measurements but has one cell with "pending" typed in it. STDEV.S ignores the text and reports the deviation across 14 values, which understates the true spread if that measurement exists but isn't yet recorded. STDEVA counts the "pending" cell as zero, which distorts the mean and the deviation far more severely. Neither is correct β the real fix is to leave the cell genuinely blank until the measurement arrives, then fill it in.
Blank cells are safe; cells containing a space or an apostrophe are not. A cell with a single space looks empty but holds a text character, and range-based functions will skip it as text while a COUNTA check reports it as filled. That mismatch is why a count of 50 rows can produce a deviation based on 48 numbers. Select the range, press Ctrl+G > Special > Blanks to find true empties, and clean text-in-number cells with Data > Text to Columns or a quick VALUE() conversion.
One more trap: dates. Excel stores dates as serial numbers, so a column of dates will calculate a standard deviation if you point a function at it. That number is meaningless as a spread measure unless you actually want to know how widely spaced your dates are β useful occasionally, misleading in most reports.
Compare STDEV.P, STDEV.S, and the Legacy STDEV Side by Side
The table below puts the six functions on the same dimensions so you can pick without guessing. Results are for the eight values 2, 4, 4, 4, 5, 5, 7, 9, computed as described in the worked example above. The "Divisor" column is the heart of the difference.
| Function | Population or sample | Divisor | Includes text/logicals? | Result for 2,4,4,4,5,5,7,9 | Modern replacement for |
|---|---|---|---|---|---|
| STDEV.S | Sample | nβ1 (7) | No | 2.138 | STDEV |
| STDEV | Sample | nβ1 (7) | No | 2.138 | STDEV.S |
| STDEVA | Sample | nβ1 (7) | Yes | Varies with entries | None (still current) |
| STDEV.P | Population | n (8) | No | 2.000 | STDEVP |
| STDEVP | Population | n (8) | No | 2.000 | STDEV.P |
| STDEVPA | Population | n (8) | Yes | Varies with entries | None (still current) |
Two rows deserve a second look. STDEV and STDEV.S produce identical output, so a legacy workbook migrating to the new function won't change a single number β good news for anyone auditing an old template. And STDEVA has no modern replacement: Microsoft kept the A suffix in both families because the text-and-logical handling is a separate behavior, not a legacy artifact.
The verdict splits by use case. Quality engineers tracking every unit from a production run should default to STDEV.P, because the run is the full population. Market researchers, teachers grading a class as a proxy for a wider cohort, and anyone working with pilot data should default to STDEV.S. Keep STDEVA for the narrow case where logical values genuinely belong in the calculation β scoring rubrics where TRUE means 1 point, for instance.
Read the Result: Units, the 68β95β99.7 Rule, and Excel's Decimal Flood
Standard deviation carries the same units as your data. If you measured delivery times in minutes, the deviation is in minutes, not minutes squared β variance is the squared measure, and that's why the square root appears in the formula. Reporting "a standard deviation of 4.2" without the unit is incomplete; say "4.2 minutes," "4.2 orders," or "4.2 millimeters."
The 68β95β99.7 rule gives the number meaning for roughly bell-shaped data. About 68 percent of values fall within one standard deviation of the mean, about 95 percent within two, and about 99.7 percent within three. For a process with a mean of 30 minutes and a deviation of 4 minutes, roughly two-thirds of deliveries land between 26 and 34 minutes. That framing turns a bare number into something a manager can act on.
Excel displays up to 15 significant digits by default in a General-formatted cell, so a result like 2.13808993529939 floods the column. Set the display to two or three decimals with Format Cells, but leave the underlying value untouched β rounding the stored number changes downstream calculations. Use ROUND() only when the rounded value is genuinely what you want to keep, such as in a published report.
Watch for the temptation to compare standard deviations across datasets with different means. A deviation of 10 on a mean of 500 is a tight spread; the same 10 on a mean of 12 is enormous. The coefficient of variation β =STDEV.S(range)/AVERAGE(range) β expresses spread as a fraction of the mean and makes the comparison fair. For the eight values above, the mean is 5 and the sample deviation is about 2.138, giving a coefficient of variation of roughly 0.428, or 42.8 percent.
One Formula, Ten Thousand Rows: STDEV.S as an Array Over Groups
A single column of data is the easy case. Real workbooks often hold thousands of rows across dozens of categories, and the standard deviation needs to be computed per group. Excel handles this with array formulas or, in Excel 365 and Excel 2021, with dynamic arrays that spill results automatically.
For a table where column A holds region names and column B holds sales figures, a modern formula like =STDEV.S(FILTER(B2:B10000, A2:A10000="North")) returns the northern region's sample deviation in one cell. Copy it down for each region, or wrap it in BYROW or a helper column to generate all groups at once. The FILTER function is available in Excel 365 and Excel 2021 onward; Excel 2019 and earlier need the legacy array approach with Ctrl+Shift+Enter.
The legacy array form is {=STDEV.S(IF(A2:A10000="North", B2:B10000))}. It works, but it's slow on large ranges and easy to break β deleting a row inside the array range can invalidate the reference. If you maintain an older workbook, the safer pattern is a helper column that flags each row with its group, then a STDEV.S pointed at a filtered copy of the data.
Performance matters here. Array formulas across 10,000 rows recalculate every time the sheet changes, and a workbook with 40 of them can turn a keystroke into a two-second pause. Pivot tables sidestep the issue: add the value field, set it to summarize by standard deviation, and Excel computes the sample deviation per group without any formula at all. The pivot route reports the sample version only, so population figures still need a formula.
A practical hybrid: build the pivot for the overview, then use a single STDEV.S per group in a summary table below it for the figures you'll publish. That keeps recalculation light and gives you a clean audit trail from raw data to reported number.
What the ToolPak's Descriptive Statistics Table Doesn't Tell You
The Analysis ToolPak's Descriptive Statistics output looks authoritative, and it is accurate β but it silently commits to the sample formula. Its "Standard Deviation" row reports the nβ1 calculation, matching STDEV.S, and the dialog offers no toggle for the population version. Anyone using the ToolPak to summarize a complete population will publish a figure slightly larger than the true population deviation.
The size of that error follows the same arithmetic as before: negligible on large datasets, meaningful on small ones. With the eight-value set, the ToolPak would report 2.138 where the population answer is exactly 2.000 β a 6.9 percent overstatement. On a 50-value set the gap is about 1 percent. The ToolPak also reports "Standard Error" as the deviation divided by the square root of the count, a distinct statistic that people sometimes mistake for the deviation itself.
The add-in also skips blanks and text without warning, exactly like STDEV.S. If your range includes header rows or footnotes, those get ignored, but if it includes a column of labels formatted as text, the count in the output reveals the truth: compare the reported "Count" against the number of rows you selected. A mismatch means Excel dropped something.
For reporting work, the ToolPak's real value is the full block of statistics delivered in one pass β you get median, mode, skewness, and range alongside the deviation, which helps you judge whether the 68β95β99.7 rule even applies. A skewness well above 1 in absolute value signals a lopsided distribution where the rule of thumb weakens.
Common Errors, Edge Cases, and When Standard Deviation Misleads
Standard deviation is a spread measure for roughly symmetric data. Run it on a bimodal distribution β order values clustered at $10 and $100 with nothing between β and the deviation will sit near the middle, describing a typical value that doesn't exist. Always plot the data before trusting the number; a five-second histogram in Insert > Charts exposes bimodality that the deviation hides.
Outliers inflate it sharply. A single data-entry error, say a 900 typed where 90 was meant, can triple the deviation of a 30-value set. Excel's TRIMMEAN and QUARTILE functions help identify suspects, and sorting the column ascending or descending makes extremes visible instantly. Correct the entry, then recompute β never trim values just because they look inconvenient.
#DIV/0! on a column you can see is full usually means the numbers are stored as text. Left-aligned digits in a General-formatted column are the tell. Select the column, use Data > Text to Columns with no delimiter, and Excel converts them to true numbers. Re-check the count afterward with =COUNT(range); if the count rises, the conversion worked.
Two settings can break formulas without any error message. If a workbook is set to manual calculation under Formulas > Calculation Options, changing the data won't update the deviation until you press F9. And if you copy a formula that uses relative references, the range shifts; anchor the data range with dollar signs, $A$2:$A$101, before copying. Neither problem announces itself, which is why both top the list of "my formula is broken" support cases.
Standard deviation also says nothing about cause, target, or acceptability. A process can have a small deviation around a wildly wrong mean, and it can have a large deviation that's entirely within specification. Pair it with a mean, a control chart, or a specification limit before drawing any operational conclusion.
FAQ
Does Excel have a built-in standard deviation function for a whole population?
Yes β STDEV.P is the population function, and it's been standard since Excel 2010. It divides by n rather than nβ1, so it returns a smaller figure than STDEV.S on identical data. Legacy STDEVP returns the same result and exists only for compatibility. The Analysis ToolPak does not offer this version, so use the function directly when you need a true population figure.
Why does STDEV return a different number than STDEV.S?
It shouldn't β STDEV and STDEV.S are algebraically identical and both divide by nβ1. If you see different results, the two formulas are pointing at different ranges, or one range includes cells the other skips. Check the range references before suspecting the function. The same identity holds between STDEVP and STDEV.P.
What's the fastest way to check whether my data is a sample or a population?
Ask whether the dataset contains every member of the group you're describing. All 12 months of a year's sales are a population; 12 months sampled from a 60-month history are a sample. A second test: if adding one more observation is possible and meaningful, treat the data as a sample. When neither test settles it, STDEV.S is the safer default because it doesn't understate spread.
Can standard deviation be negative or larger than the mean?
It can never be negative, because it's the square root of a sum of squares. It can absolutely exceed the mean β a set with a mean of 3 and a deviation of 5 is entirely possible if values swing widely. That situation usually signals skewed data or outliers, and it's a signal to inspect the distribution before reporting the figure.
Does STDEV.S work on filtered or hidden rows?
It calculates over every cell in the range, including hidden rows and rows removed by a filter. If you need the deviation of only the visible rows, use SUBTOTAL with function number 7 for the sample deviation or 8 for the population version, written as =SUBTOTAL(7, B2:B100). Plain STDEV.S will quietly include rows you thought you'd filtered out.
How many values do I need before standard deviation is meaningful?
Excel will compute a sample deviation from as few as two numbers, but the result is unstable. A common working threshold is 30 observations before treating the deviation as a reliable estimate of spread. Below that, report the raw values alongside the deviation so readers can see what produced it.
Why did my formula work yesterday and return #DIV/0! today?
Something removed the numeric values from the range. A filter doesn't do this, but deleting rows, clearing cells, or pasting text over numbers does. Click the error cell, use Evaluate Formula under Formulas, and step through to see which reference has gone empty. Then confirm the range still points where you intended.
Is sample standard deviation always the right choice for survey data?
Not automatically. A survey of all 40 attendees at a single workshop is a population of that workshop, even though it feels like a sample. The distinction follows the group you're describing, not the data-collection method. Decide what population the number is meant to represent, then pick the function that matches.