Database function

DMAX function

Returns the largest number in a column of a list, considering only the records that match the conditions in a criteria range.

Available in All versions of Excel, including Microsoft 365 and Excel for the web

In every Excel versionWorks in Google Sheets

Syntax

DMAX(database, field, criteria)
ArgumentWhat it means
databaseRequiredThe list including its header row.
fieldRequiredThe column to search for the maximum, as a header in quotes or a column number.
criteriaRequiredThe criteria range.

Returns: The highest matching number, or 0 if no record matches.

How DMAX works

DMAX finds the highest value among the records that meet your conditions: the top salary in a department, the largest order from a region, the latest date for a customer (dates are numbers, so the maximum is the most recent). Like all D-functions it reads its conditions from a criteria range — headings plus conditions — on the worksheet.

Be aware that when nothing matches, DMAX returns 0 rather than an error. On a dashboard that can look like a real result, so it is worth pairing it with DCOUNT or checking that the criteria are spelled correctly. The modern equivalent with conditions written inside the formula is MAXIFS.

Examples

1Top salary in Sales

F2fx=DMAX(A1:D7, "Salary", A9:A10)
ABCDEF
1DeptNameYearsSalary
2SalesAna34200046500
3ITBen758000
4SalesCarla546500
5ITDev249000
6HREli951000
7SalesFay138500
8
9Dept
10Sales

Result: 46500

The Sales salaries are 42,000, 46,500 and 38,500; the highest is 46,500.

2Top salary among staff with 5+ years

F2fx=DMAX(A1:D7, "Salary", A9:A10)
ABCDEF
1DeptNameYearsSalary
2SalesAna34200058000
3ITBen758000
4SalesCarla546500
5ITDev249000
6HREli951000
7SalesFay138500
8
9Years
10>=5

Result: 58000

Ben (7 years, 58,000), Carla (5 years) and Eli (9 years) qualify; Ben's 58,000 is the maximum.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 14 KB

Common errors and how to fix them

ErrorWhy it happensFix
0 instead of an errorNo record matches the criteria.Check with DCOUNT that at least one record matches.
#VALUE!The field is not a header of the list.Use the exact header text or a column number.

Tips

  • To return who has the maximum, use the DMAX result as the criteria of DGET or look it up with XLOOKUP.
  • Combine conditions in one criteria row (Dept = Sales and Years = >=3) for AND logic.

Google Sheets

DMAX also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

DMAX in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
DanishDMAKS
DutchDBMAX
FinnishTMAKS
FrenchBDMAX
GermanDBMAX
HungarianAB.MAX
ItalianDB.MAX
Norwegian (Bokmål)DMAKS
PolishBD.MAX
Portuguese (Brazil)BDMÁX
Portuguese (Portugal)BDMÁX
RussianДМАКС
SpanishBDMAX
TurkishVSEÇMAK