Database functions
DSTDEV
Matches all 3 recorded answers
Recorded: 3 workbook cells. How we measure this · See the Rust code
Local names in 40 languages
| Language | Name in Excel |
|---|---|
| Arabic | DSTDEV |
| Bulgarian | DSTDEV |
| Czech | DSMODCH.VÝBĚR |
| Danish | DSTDAFV |
| German | DSTDEV |
| Greek | DSTDEV |
| English (Australia) | DSTDEV |
| English (United Kingdom) | DSTDEV |
| English (United States) | DSTDEV |
| Spanish | BDDESVEST |
| Estonian | DSTDEV |
| Finnish | TKESKIHAJONTA |
| French | BDECARTYPE |
| Hebrew | DSTDEV |
| Croatian | DSTDEV |
| Hungarian | AB.SZÓRÁS |
| Indonesian | DSTDEV |
| Italian | DSTDEV |
| Japanese | DSTDEV |
| Korean | DSTDEV |
| Lithuanian | DSTDEV |
| Latvian | DSTDEV |
| Norwegian | DSTDAV |
| Dutch | DBSTDEV |
| Polish | BD.ODCH.STANDARD |
| Portuguese (Brazil) | DSTDEV |
| Portuguese (Portugal) | BDDESVPAD |
| Romanian | DSTDEV |
| Russian | ДСТАНДОТКЛ |
| Slovak | DSTDEV |
| Slovenian | DSTDEV |
| Serbian (Latin) | DSTDEV |
| Swedish | DSTDAV |
| Thai | DSTDEV |
| Turkish | VSEÇSTDSAPMA işlevi |
| Ukrainian | DSTDEV |
| Vietnamese | DSTDEV |
| Chinese (Simplified) | DSTDEV |
| Chinese (Hong Kong) | DSTDEV |
| Chinese (Traditional) | DSTDEV |
Names from Microsoft's support site.
What it does
DSTDEV(database, field, criteria)
DSTDEV(database, field, criteria) selects the records of database that satisfy criteria,
reads the column named by field, and returns the sample standard deviation of the numeric
values found there.
With V = [ v₁ … vₙ ] the Numbers collected from the field column of the matching records, in record order, and n = |V|:
x̄ = (Σ vᵢ) / n
s = √( Σ (vᵢ − x̄)² / (n − 1) )
Operationally it is DVAR followed by one square root; the reference implementation computes it exactly that way. Sample semantics mean the divisor is n − 1 and at least two numeric values are required.
Non-numeric cells in the field column — text, logicals, blanks — are skipped, so n counts numbers, not records.
The selection stage — header matching, AND across a criteria row, OR down the rows, blank criteria cells, and criteria-expression parsing — is identical for all twelve database functions and is explained once in the criteria-range mechanism.
The extra rounding step
DSTDEV is not a single rounded operation. The variance is computed and rounded to a double,
and then the square root of that rounded value is taken and rounded again. The result is
therefore not in general the correctly rounded standard deviation of the input data: two
roundings sit between the exact answer and the published one. IEEE-754 square root is itself
correctly rounded, so the discrepancy comes entirely from the intermediate — which means an
implementation that computed s directly, more accurately, would differ from the composed
route on some inputs. Matching a composed route is a compatibility target, not an accuracy
target, and the Handbook has not established which route Excel takes.
Arguments
Three arguments, all required at the call site; the reference implementation declares an arity of exactly 3.
database— the header-plus-records range or array.field— the column selector, as header text or as a 1-based column index within the database range. Required.criteria— the header-plus-conditions range or array.
Try it
Quirks
Result and edge cases
Returns a Number, non-negative.
- Fewer than two numeric values selected:
#DIV/0!— the error comes from the variance stage, before any square root is attempted. - All selected values equal:
0, exactly, since the variance is exactly zero and √0 is 0. - Text that looks numeric in the field column is skipped, per the range-scan side of the asymmetry in coercion and lifting.
- Logicals in the field column are skipped.
- Arrays: inline array literals resolve to grids and are accepted;
DSTDEVis not a lift kernel. - No negative-argument path. Because the two-pass variance cannot be negative, the square
root has no domain failure. An implementation using the sum-of-squares form could produce a
negative variance and hence a
#NUM!from the root — an errorDSTDEVshould never be able to return.
Errors
| Error | Condition |
|---|---|
#DIV/0! | Fewer than two numeric values were collected from the field column of the matching records |
#VALUE! | database or criteria is not a grid or is empty; a database header cell is blank; a criteria header names no database field; field matches no header, or is a non-integer or out-of-range column index |
| propagated | An error value in a header cell, a criteria cell, or a scanned field cell surfaces as that error |
How to implement
Notes for implementers
- Compose, do not reformulate. Computing the variance and taking its square root is what the reference implementation does; a more accurate direct route is a different function in the last bits.
- Guard the count before the arithmetic.
#DIV/0!at n < 2 is a domain decision. - Both accumulation passes are sequential left folds in record order, per the family's declared reduction policy.
- Skip, do not coerce. Admit only cells whose value kind is Number.
- Numeric criteria comparison is not exact double comparison — see the note in the shared mechanism.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
DSTDEV · 1 lines · calc-func/src/catalogue/database.rs on GitHub8 dstdev "DSTDEV" (3, 3) [R "database", V "field", R "criteria"] |s, a, sv| { database(s, a, sv, Kind::Stdev) }
Kernels shared with other functions
readercatalogue/aggregateread_referencecatalogue/aggregatenumberscatalogue/comparisonin_bandcatalogue/comparisonRounded::upcatalogue/comparisonRoundings::ofcatalogue/comparisonRoundings::disjointcatalogue/comparisontextscatalogue/comparisoncomparecatalogue/comparison/collationweighedcatalogue/comparison/collationmeasured_iteration_extensioncatalogue/comparison/collationtablecatalogue/comparison/sort_keydecode64catalogue/comparison/sort_keyReader::bytecatalogue/comparison/sort_keyReader::varintcatalogue/comparison/sort_keyReader::donecatalogue/comparison/sort_keyin_rangescatalogue/comparison/sort_keybuildcatalogue/comparison/sort_keyhan_basecatalogue/comparison/sort_keyderivecatalogue/comparison/sort_keyshared_jamo_tailscatalogue/comparison/sort_keyordinary_jamo_prefixcatalogue/comparison/sort_keyindependent_jamo_suffixcatalogue/comparison/sort_keyjamo_leading_primarycatalogue/comparison/sort_keyleading_ordercatalogue/comparison/sort_keyBefore::separate_specialcatalogue/comparison/sort_keyGathered::kanacatalogue/comparison/sort_keyGathered::unitcatalogue/comparison/sort_keypartscatalogue/comparison/sort_keydiacritic_ordercatalogue/comparison/sort_keydiacriticscatalogue/comparison/sort_keyrangecatalogue/conditionalrowcatalogue/conditionaloffsetcatalogue/conditionalread_rangecatalogue/conditionalverdictscatalogue/conditionalusedcatalogue/conditionalMatch::ofcatalogue/conditionalMatch::negatedcatalogue/conditionalOp::holdscatalogue/conditionalOp::is_equalitycatalogue/conditionalspellscatalogue/conditionalcriterioncatalogue/conditionaldatabase_criterioncatalogue/conditionalrankcatalogue/conditionalcriterion_textcatalogue/conditionaldecidedcatalogue/conditionalCriterion::verdictcatalogue/conditionalequalitycatalogue/conditionalis_surrogatecatalogue/conditionalwildcardcatalogue/conditionallabelcatalogue/databasesame_labelcatalogue/databasefieldcatalogue/databasematchingcatalogue/databasecriterion_verdictcatalogue/databasedatabasecatalogue/databasepublishedcatalogue/databaselow32decimalNatural::from_u64decimalNatural::pow10decimalNatural::normalizedecimalNatural::is_zerodecimalNatural::mul_add_smalldecimalNatural::times_pow10decimalNatural::times_pow5decimalNatural::times_pow2decimalExactDecimal::binarydecimalexcel_sqrt_stagedported/excel_numerictextported/text_kernelstext_from_strported/text_kernelsfold_unitported/text_kernelspush_singleton_or_originalported/text_kernelspush_lowerported/text_kernelslowerported/text_kernelsvariance_from_valuesported/variance_commonstdev_from_valuesported/variance_common
Argument and result plumbing
No implementation has been published with a Handbook test suite for this function.
Version differences
No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.
Alternatives
Relationships
- DSTDEVP is the population form: divisor n, and one value is enough.
- DVAR is the square of this function, and the page that carries the shared numerical discussion.
- Nearest modern equivalent:
STDEV.Sover a filtered array. Excel's compatibility rename pass producedSTDEV/STDEV.S; the database family was not renamed, soDSTDEVis not a deprecated name and has no.S-suffixed replacement. - Confused with:
DSTDEVP(the divisor and the minimum count) andSTDEVA, which counts logicals and text.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents