Database functions
DMAX
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 | DMAX |
| Bulgarian | DMAX |
| Czech | DMAX |
| Danish | DMAKS |
| German | DMAX |
| Greek | DMAX |
| English (Australia) | DMAX |
| English (United Kingdom) | DMAX |
| English (United States) | DMAX |
| Spanish | BDMAX |
| Estonian | DMAX |
| Finnish | TMAKS |
| French | BDMAX |
| Hebrew | DMAX |
| Croatian | DMAX |
| Hungarian | AB.MAX |
| Indonesian | DMAX |
| Italian | DMAX |
| Japanese | DMAX |
| Korean | DMAX |
| Lithuanian | DMAX |
| Latvian | DMAX |
| Norwegian | DMAX |
| Dutch | DBMAX |
| Polish | BD.MAX |
| Portuguese (Brazil) | DMAX |
| Portuguese (Portugal) | BDMÁX |
| Romanian | DMAX |
| Russian | ДМАКС |
| Slovak | DMAX |
| Slovenian | DMAX |
| Serbian (Latin) | DMAX |
| Swedish | DMAX |
| Thai | DMAX |
| Turkish | VSEÇMAK işlevi |
| Ukrainian | DMAX |
| Vietnamese | DMAX |
| Chinese (Simplified) | DMAX |
| Chinese (Hong Kong) | DMAX |
| Chinese (Traditional) | DMAX |
Names from Microsoft's support site.
What it does
DMAX(database, field, criteria)
DMAX(database, field, criteria) selects the records of database that satisfy criteria,
reads the column named by field, and returns the largest of the numeric values found there.
With R the set of selected record rows, c the resolved field column, and
V = [ v : v = value of cell (r, c) for r in R, where v is a Number ]
That zero is a genuine hazard on a column of negative numbers: a criteria range that matches
nothing, or matches only records with blank field cells, gives 0 — a value larger than every
number actually in the column.
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.
Try it
Quirks
Result and edge cases
Returns a Number.
- No numeric value selected — because no record matched, or because every matching record's
field cell is blank or non-numeric:
0, not an error. Pair with DCOUNT if you need to tell "the maximum is zero" from "there was nothing to maximize". - 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, so
TRUEnever wins as 1. - Ties are invisible:
DMAXreturns the value, not which record held it. Use DGET with a criteria row keyed on the maximum if you need the record. - Arrays: inline array literals resolve to grids and are accepted;
DMAXis not a lift kernel.
Errors
| Error | Condition |
|---|---|
#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
- The empty-selection answer is a convention, not a mathematical result. Returning
0rather than an error is a deliberate compatibility choice, and it must be applied after skipping non-numeric cells, not as a substitute for them. - 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.
DMAX · 1 lines · calc-func/src/catalogue/database.rs on GitHub5 dmax "DMAX" (3, 3) [R "database", V "field", R "criteria"] |s, a, sv| { database(s, a, sv, Kind::Max) }
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
- DMIN is the mirror member, identical in every respect but the comparison direction — including the empty-selection zero.
- Nearest modern equivalent:
MAXIFS, which takes conditions inline instead of as a criteria table. Neither supersedes the other; Excel supports both. - Confused with:
MAX(no selection stage),LARGE(k-th largest, no selection stage), andMAXA(which does count logicals and text as values).
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents