Category: FUNCTION | Updated: 2026-11-22
How to Use the DMAX Function in Google Sheets | Extract the Maximum Value Matching Criteria from a Database
Syntax
=DMAX(database, field, criteria)
- database: Specifies the entire cell range of the data, including headers in the first row.
- field: Specifies the header name of the column from which to find the maximum value, or its column number from the left.
- criteria: Specifies the cell range containing the filter conditions (headers + condition values).
Practical Example with a Table
Here is an example of extracting the highest sales amount among products in the “Appliances” category (specified in criteria range E1:E2) from product sales data (A1:C6).
| Cell Range | Role | Contents |
|---|---|---|
A1:C6 |
Database | Row 1: Category, Product Name, Sales Amount / Rows 2–6: product data |
E1:E2 |
Criteria Range | E1 = Category, E2 = Appliances |
| Formula Cell | Maximum Result | =DMAX(A1:C6, "Sales Amount", E1:E2) → Outputs the highest sales amount in the Appliances category |
Common Errors and Notes
- #VALUE! Error: Occurs if the
fieldcolumn name is not found or if the header row is not included indatabase. - “0” When No Match Is Found: Because
0is returned even when no records match, combine it withDCOUNTif you need to distinguish between an actual maximum of0and no matching data. - Specifying a Text Column: Specifying a column that contains only text cannot compare maximum values and returns
0.
Frequently Asked Questions
Q. Can the DMAX function retrieve the latest date?
A. Yes. Because Google Sheets stores dates internally as numbers (serial values), specifying a date column as the field retrieves the most recent date matching the criteria.
Q. What is the result if no records match the criteria?
A. If no matching data exists, the DMAX function returns "0" rather than an error.