Formualizer Docs

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

ArgumentTypeRequiredDefault
databaseanyRequired—
fieldanyRequired—
criteriaanyRequired—

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

  • field resolves 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)

Input cells
ABE
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)

Input cells
ABE
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)

Input cells
ABE
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)

Input cells
ABD
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)

Input cells
ABF
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)

Input cells
ABCDEGH
1"Region""Salesperson""Product""Units""Revenue""Region""Product"
2"West""Diaz""Widget"24126000"North""Widget"
3"East""Patel""Gadget"31142500
4"North""Kim""Widget"1887000
5"West""Ramos""Service"1246000
6"South""Lee""Gadget"27119000
7"East""Noor""Widget"22101000

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)

Input cells
ABCDEG
1"Region""Salesperson""Product""Units""Revenue""Region"
2"West""Diaz""Widget"24126000"East"
3"East""Patel""Gadget"31142500
4"North""Kim""Widget"1887000
5"West""Ramos""Service"1246000
6"South""Lee""Gadget"27119000
7"East""Noor""Widget"22101000

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?.

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!.

Implementation

Engine source

On this page