Database functions
DVARP
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 | DVARP |
| Bulgarian | DVARP |
| Czech | DVAR |
| Danish | DVARP |
| German | DVARP |
| Greek | DVARP |
| English (Australia) | DVARP |
| English (United Kingdom) | DVARP |
| English (United States) | DVARP |
| Spanish | BDVARP |
| Estonian | DVARP |
| Finnish | TVARIANSSIP |
| French | BDVARP |
| Hebrew | DVARP |
| Croatian | DVARP |
| Hungarian | AB.VAR2 |
| Indonesian | DVARP |
| Italian | DVARP |
| Japanese | DVARP |
| Korean | DVARP |
| Lithuanian | DVARP |
| Latvian | DVARP |
| Norwegian | DVARP |
| Dutch | DBVARP |
| Polish | BD.WARIANCJA.POPUL |
| Portuguese (Brazil) | DVARP |
| Portuguese (Portugal) | BDVARP |
| Romanian | DVARP |
| Russian | БДДИСПП |
| Slovak | DVARP |
| Slovenian | DVARP |
| Serbian (Latin) | DVARP |
| Swedish | DVARIANSP |
| Thai | DVARP |
| Turkish | VSEÇVARS işlevi |
| Ukrainian | DVARP |
| Vietnamese | DVARP |
| Chinese (Simplified) | DVARP |
| Chinese (Hong Kong) | DVARP |
| Chinese (Traditional) | DVARP |
Names from Microsoft's support site.
What it does
DVARP(database, field, criteria)
DVARP(database, field, criteria) selects the records of database that satisfy criteria,
reads the column named by field, and returns the population variance 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
σ² = ( Σ (vᵢ − x̄)² ) / n
The only difference from DVAR is the divisor: n rather than n − 1. That single change has two consequences worth stating separately, because readers usually notice the first and are caught by the second:
DVARPis always the smaller of the two, by the factor (n − 1)/n.DVARPis defined for n = 1 — the variance of a one-element population is exactly zero — whereasDVARrequires two values. The two functions therefore disagree about whether a given selection is an error at all, not merely about the number.
Choosing between them is a modelling question, not a numerical one: divide by n when the
selected records are the whole population you are describing, and by n − 1 when they are a
sample drawn from a larger one. A criteria-filtered subset of a spreadsheet is very often the
whole population of interest, which is why DVARP is less exotic here than VAR.P is in
general statistics.
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.
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, always non-negative under the two-pass form.
- No numeric value selected:
#DIV/0!. Unlike the count and sum members, the statistical members do error on an empty selection. - Exactly one numeric value selected:
0, not an error. This is the sharpest observable difference from DVAR, which returns#DIV/0!on the same input. - All selected values equal:
0, exactly, under the two-pass form. - 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;
DVARPis not a lift kernel.
Errors
| Error | Condition |
|---|---|
#DIV/0! | No numeric value was 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
- Guard on n = 0 only. The sample and population members differ in exactly this predicate; sharing the code path and switching only the divisor, without also switching the minimum count, is the natural bug here.
- Use the two-pass form — see DVAR.
- The n = 1 answer should be exactly
+0, not a denormal residual. The two-pass form gives that for free; a sum-of-squares form may not. - 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. A tolerant match changes n, and here n is the divisor.
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.
DVARP · 1 lines · calc-func/src/catalogue/database.rs on GitHub12 dvarp "DVARP" (3, 3) [R "database", V "field", R "criteria"] |s, a, sv| { database(s, a, sv, Kind::VarP) }
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
- DVAR is the sample form.
DVARP × n = DVAR × (n − 1)whenever both are defined. - DSTDEVP is
SQRT(DVARP). - Nearest modern equivalent:
VAR.Pover a filtered array. Excel's compatibility rename pass produced theVARP/VAR.Ppair; the database family was left alone, soDVARPis not a deprecated name and has no.P-suffixed replacement. - Confused with:
DVAR(the divisor and the one-value boundary) andVARPA, which counts logicals and text as values.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents