DGET
Returns a single field value from the only record that matches criteria.
DGET is useful for keyed lookups where criteria are expected to identify exactly one record.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=DGET(database, field, criteria)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
database | any | Required | — |
field | any | Required | — |
criteria | any | Required | — |
Remarks
- An equality criterion for a date or number (
"10/26/1999","36459",36459) also matches text cells holding that date;<>and ordering criteria do not read date text. - Criteria rows are OR alternatives; criteria columns inside one row are AND predicates.
Error cases
fieldresolves from a case-insensitive header name or 1-based index; unresolved field/header references return#VALUE!.- Returns
#VALUE!when no records match and#NUM!when multiple records match.
Examples
Retrieve the Score from the only West record.
Formula =DGET(A1:B4,"Score",E1:E2)
| A | B | E | |
|---|---|---|---|
| 1 | "Team" | "Score" | "Team" |
| 2 | "East" | 8 | "West" |
| 3 | "West" | 3 | |
| 4 | "East" | 10 |
Expected result 3
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Select the same field by numeric position.
Formula =DGET(A1:B4,2,E1:E2)
| A | B | E | |
|---|---|---|---|
| 1 | "Team" | "Score" | "Team" |
| 2 | "East" | 8 | "West" |
| 3 | "West" | 3 | |
| 4 | "East" | 10 |
Expected result 3
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Return a text field from the matching record.
Formula =DGET(A1:B4,"Team",E1:E2)
| A | B | E | |
|---|---|---|---|
| 1 | "Team" | "Score" | "Team" |
| 2 | "East" | 8 | "West" |
| 3 | "West" | 3 | |
| 4 | "East" | 10 |
Expected result West
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
The East criterion matches two rows, so there is no single record to retrieve.
Formula =DGET(A1:B4,"Score",D1:D2)
| A | B | D | |
|---|---|---|---|
| 1 | "Team" | "Score" | "Team" |
| 2 | "East" | 8 | "East" |
| 3 | "West" | 3 | |
| 4 | "East" | 10 |
Expected result #NUM!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
The North criterion matches no records.
Formula =DGET(A1:B4,"Score",F1:F2)
| A | B | F | |
|---|---|---|---|
| 1 | "Team" | "Score" | "Team" |
| 2 | "East" | 8 | "North" |
| 3 | "West" | 3 | |
| 4 | "East" | 10 |
Expected result #VALUE!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Get salesperson for a unique North Widget record
Formula =DGET(A1:E7, "Salesperson", G1:H2)
| A | B | C | D | E | G | H | |
|---|---|---|---|---|---|---|---|
| 1 | "Region" | "Salesperson" | "Product" | "Units" | "Revenue" | "Region" | "Product" |
| 2 | "West" | "Diaz" | "Widget" | 24 | 126000 | "North" | "Widget" |
| 3 | "East" | "Patel" | "Gadget" | 31 | 142500 | ||
| 4 | "North" | "Kim" | "Widget" | 18 | 87000 | ||
| 5 | "West" | "Ramos" | "Service" | 12 | 46000 | ||
| 6 | "South" | "Lee" | "Gadget" | 27 | 119000 | ||
| 7 | "East" | "Noor" | "Widget" | 22 | 101000 |
Expected result Kim
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Multiple matches return NUM error
Formula =DGET(A1:E7, 5, G1:G2)
| A | B | C | D | E | G | |
|---|---|---|---|---|---|---|
| 1 | "Region" | "Salesperson" | "Product" | "Units" | "Revenue" | "Region" |
| 2 | "West" | "Diaz" | "Widget" | 24 | 126000 | "East" |
| 3 | "East" | "Patel" | "Gadget" | 31 | 142500 | |
| 4 | "North" | "Kim" | "Widget" | 18 | 87000 | |
| 5 | "West" | "Ramos" | "Service" | 12 | 46000 | |
| 6 | "South" | "Lee" | "Gadget" | 27 | 119000 | |
| 7 | "East" | "Noor" | "Widget" | 22 | 101000 |
Expected result #NUM!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
Why does DGET fail when criteria match two rows?
DGET requires exactly one matching record; multiple matches produce #NUM! and zero matches produce #VALUE!.