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)| Argument | What it means | |
|---|---|---|
database | Required | The list including its header row. |
field | Required | The column to search for the maximum, as a header in quotes or a column number. |
criteria | Required | The 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
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Dept | Name | Years | Salary | ||
| 2 | Sales | Ana | 3 | 42000 | 46500 | |
| 3 | IT | Ben | 7 | 58000 | ||
| 4 | Sales | Carla | 5 | 46500 | ||
| 5 | IT | Dev | 2 | 49000 | ||
| 6 | HR | Eli | 9 | 51000 | ||
| 7 | Sales | Fay | 1 | 38500 | ||
| 8 | ||||||
| 9 | Dept | |||||
| 10 | Sales |
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
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Dept | Name | Years | Salary | ||
| 2 | Sales | Ana | 3 | 42000 | 58000 | |
| 3 | IT | Ben | 7 | 58000 | ||
| 4 | Sales | Carla | 5 | 46500 | ||
| 5 | IT | Dev | 2 | 49000 | ||
| 6 | HR | Eli | 9 | 51000 | ||
| 7 | Sales | Fay | 1 | 38500 | ||
| 8 | ||||||
| 9 | Years | |||||
| 10 | >=5 |
Result: 58000
Ben (7 years, 58,000), Carla (5 years) and Eli (9 years) qualify; Ben's 58,000 is the maximum.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
0 instead of an error | No 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 andYears=>=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.
| Language | Function name |
|---|---|
| Danish | DMAKS |
| Dutch | DBMAX |
| Finnish | TMAKS |
| French | BDMAX |
| German | DBMAX |
| Hungarian | AB.MAX |
| Italian | DB.MAX |
| Norwegian (Bokmål) | DMAKS |
| Polish | BD.MAX |
| Portuguese (Brazil) | BDMÁX |
| Portuguese (Portugal) | BDMÁX |
| Russian | ДМАКС |
| Spanish | BDMAX |
| Turkish | VSEÇMAK |