DGET function
DGET returns the single value from one column of a list for the one row that matches your criteria. It gives #VALUE! if more than one row matches and #NUM! if none do.
Example
Read it as a sentence: in the table A1:C5, pull out the single Qty value for the row that matches the criteria in E1:E2.
A
B
C
D
1
5
2
3
Syntax
DGET(database, field, criteria)
-
database(required) - Range (with header row) that holds the list.
-
field(required) - Column to use, given as its header text in quotes or as a column number.
-
criteria(required) - Range with matching headers on top and conditions underneath.
Returns: The single matching value.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=DGET(Data!Q1:S6,"Qty",Data!V1:V2) | 20 | Criteria Item=Pear (1 row) |
=DGET(Data!Q1:S6,"Qty",Data!X1:Y2) | 10 | AND criteria (same row) |
=DGET(Data!Q1:S6,"Qty",Data!U1:U2) | #NUM! | Criteria Item=Apple (2 rows) |
=DGET(Data!Q1:S6,"Qty",Data!W1:W2) | #VALUE! | No matching rows |
=DGET(Data!Q1:S6,"Qty",Data!Z1:Z3) | #NUM! | OR criteria (two rows) |
=DGET(Data!Q1:S6,"Qty",Data!AA1:AA2) | #NUM! | Numeric criteria >15 |
=DGET(Data!Q1:S6,"Qty",Data!AB1:AB2) | #NUM! | Blank criterion matches all |
=DGET(Data!Q1:S6,"Qty",Data!AC1:AC2) | #VALUE! | Criteria header not in database |
References with a sheet name, like Items!, point at sample tables in our test workbook.
Watch out for
- Criteria headers must match the database headers exactly.
- Returns #VALUE! if more than one row matches and #NUM! if none do.
- Excel refuses the formula outright if you type an array constant such as {1,2,3} where a range is expected; point it at cells instead (measured in Excel 16.0.20527).
Where it works
- Excel
- DGET is in every version of Excel from 2007 on.
- Google Sheets
- Same name, same behaviour for everyday use. Sheets has it, but takes cell ranges; array-constant databases are Excel-only.
Part of Database functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .