Database functions
DGET
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 | DGET |
| Bulgarian | DGET |
| Czech | DGET |
| Danish | DHENT |
| German | DGET |
| Greek | DGET |
| English (Australia) | DGET |
| English (United Kingdom) | DGET |
| English (United States) | DGET |
| Spanish | BDEXTRAER |
| Estonian | DGET |
| Finnish | TNOUDA |
| French | BDLIRE |
| Hebrew | DGET |
| Croatian | DGET |
| Hungarian | AB.MEZŐ |
| Indonesian | DGET |
| Italian | DGET |
| Japanese | DGET |
| Korean | DGET |
| Lithuanian | DGET |
| Latvian | DGET |
| Norwegian | DGET |
| Dutch | DBLEZEN |
| Polish | BD.POLE |
| Portuguese (Brazil) | DGET |
| Portuguese (Portugal) | BDOBTER |
| Romanian | DGET |
| Russian | БИЗВЛЕЧЬ |
| Slovak | DGET |
| Slovenian | DGET |
| Serbian (Latin) | DGET |
| Swedish | DHÄMTA |
| Thai | DGET |
| Turkish | VAL işlevi |
| Ukrainian | DGET |
| Vietnamese | DGET |
| Chinese (Simplified) | DGET |
| Chinese (Hong Kong) | DGET |
| Chinese (Traditional) | DGET |
Names from Microsoft's support site.
What it does
DGET(database, field, criteria)
DGET(database, field, criteria) selects the records of database that satisfy criteria and
returns the value held in the column named by field — but only if exactly one record
matches.
|R| = 0 → #VALUE!
|R| = 1 → the value of cell (the matching record, field column)
|R| > 1 → #NUM!
The uniqueness requirement is the point of the function. DGET is a lookup that refuses to
guess: where VLOOKUP silently returns the first of several matches, DGET reports that the
question was ambiguous.
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: unlike DCOUNT and DCOUNTA,DGEThas nothing to return without a column.criteria— the header-plus-conditions range or array. Note the family rule that bites hardest here: a criteria range with no condition rows, or with an all-blank condition row, selects every record — so on any database with two or more records that mistake produces#NUM!, not the "first record" a reader might expect.
Try it
Quirks
Result and edge cases
Returns whatever kind the selected cell holds: Number, Text, or Logical.
- The selected cell holds an error value: that error is returned.
DGETpasses the cell through rather than diagnosing it. - Text is returned as text.
DGETis the only family member that can return a non-numeric result, which matters when its output feeds arithmetic downstream. - Arrays: inline array literals resolve to grids and are accepted;
DGETis not a lift kernel, and it never returns an array.
Errors
| Error | Condition |
|---|---|
#VALUE! | No record matches the criteria |
#NUM! | More than one record matches the criteria |
#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 or a criteria cell surfaces as that error; an error value in the selected cell is returned as the function's result |
How to implement
Notes for implementers
- Count matches before reading any cell. The uniqueness test governs the whole result, and an implementation that reads the first match eagerly will produce a value where an error is required.
- The two error codes are not interchangeable and are not
#N/A. Getting the pair backwards is a silent semantic bug: both are errors, so a naive test that only checksISERRORwill not catch it. - Numeric criteria comparison is not exact double comparison — see the note in
the shared mechanism.
For
DGETthe consequence is sharper than for the aggregates: a tolerant comparison can turn a unique match into a double match, converting a value into#NUM!.
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.
DGET · 1 lines · calc-func/src/catalogue/database.rs on GitHub4 dget "DGET" (3, 3) [R "database", V "field", R "criteria"] |s, a, sv| { database(s, a, sv, Kind::Get) }
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
- Siblings: the other eleven database functions, which share the selection stage and reduce
the field column instead of selecting from it. Where they answer "how much",
DGETanswers "which". - Nearest modern equivalents:
XLOOKUPandFILTER.FILTERis the closest in spirit — criteria in, records out — but returns every match as a spilled array rather than insisting on uniqueness.XLOOKUPreturns the first match and takes a not-found argument. Neither supersedesDGET; Excel retains all three. - Confused with:
VLOOKUPandINDEX/MATCH, both of which return the first match without complaint. ReplacingDGETwithVLOOKUPto "fix" a#NUM!discards the very check that was reporting a real ambiguity in the data.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents