{
  "category": "Database functions",
  "display_name": "DGET",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.DGET",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 3 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 3 recorded answers",
    "workbook_corpus": {
      "cells": 3,
      "matched": 3
    }
  },
  "implementations": [
    {
      "commit": "9e1884369a678158dd82d3d74188daf986995e87",
      "flavour": "excel-compatibility-candidate",
      "language": "Rust",
      "name": "CalcFunc",
      "own_code": [
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/database.rs#L267-L267"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/aggregate::reader",
        "catalogue/aggregate::read_reference",
        "catalogue/comparison::numbers",
        "catalogue/comparison::in_band",
        "catalogue/comparison::Rounded::up",
        "catalogue/comparison::Roundings::of",
        "catalogue/comparison::Roundings::disjoint",
        "catalogue/comparison::texts",
        "catalogue/comparison/collation::compare",
        "catalogue/comparison/collation::weighed",
        "catalogue/comparison/collation::measured_iteration_extension",
        "catalogue/comparison/sort_key::table",
        "catalogue/comparison/sort_key::decode64",
        "catalogue/comparison/sort_key::Reader::byte",
        "catalogue/comparison/sort_key::Reader::varint",
        "catalogue/comparison/sort_key::Reader::done",
        "catalogue/comparison/sort_key::in_ranges",
        "catalogue/comparison/sort_key::build",
        "catalogue/comparison/sort_key::han_base",
        "catalogue/comparison/sort_key::derive",
        "catalogue/comparison/sort_key::shared_jamo_tails",
        "catalogue/comparison/sort_key::ordinary_jamo_prefix",
        "catalogue/comparison/sort_key::independent_jamo_suffix",
        "catalogue/comparison/sort_key::jamo_leading_primary",
        "catalogue/comparison/sort_key::leading_order",
        "catalogue/comparison/sort_key::Before::separate_special",
        "catalogue/comparison/sort_key::Gathered::kana",
        "catalogue/comparison/sort_key::Gathered::unit",
        "catalogue/comparison/sort_key::parts",
        "catalogue/comparison/sort_key::diacritic_order",
        "catalogue/comparison/sort_key::diacritics",
        "catalogue/conditional::range",
        "catalogue/conditional::row",
        "catalogue/conditional::offset",
        "catalogue/conditional::read_range",
        "catalogue/conditional::verdicts",
        "catalogue/conditional::used",
        "catalogue/conditional::Match::of",
        "catalogue/conditional::Match::negated",
        "catalogue/conditional::Op::holds",
        "catalogue/conditional::Op::is_equality",
        "catalogue/conditional::spells",
        "catalogue/conditional::criterion",
        "catalogue/conditional::database_criterion",
        "catalogue/conditional::rank",
        "catalogue/conditional::criterion_text",
        "catalogue/conditional::decided",
        "catalogue/conditional::Criterion::verdict",
        "catalogue/conditional::equality",
        "catalogue/conditional::is_surrogate",
        "catalogue/conditional::wildcard",
        "catalogue/database::label",
        "catalogue/database::same_label",
        "catalogue/database::field",
        "catalogue/database::matching",
        "catalogue/database::criterion_verdict",
        "catalogue/database::database",
        "catalogue/database::published",
        "decimal::low32",
        "decimal::Natural::from_u64",
        "decimal::Natural::pow10",
        "decimal::Natural::normalize",
        "decimal::Natural::is_zero",
        "decimal::Natural::mul_add_small",
        "decimal::Natural::times_pow10",
        "decimal::Natural::times_pow5",
        "decimal::Natural::times_pow2",
        "decimal::ExactDecimal::binary",
        "ported/excel_numeric::excel_sqrt_staged",
        "ported/text_kernels::text",
        "ported/text_kernels::text_from_str",
        "ported/text_kernels::fold_unit",
        "ported/text_kernels::push_singleton_or_original",
        "ported/text_kernels::push_lower",
        "ported/text_kernels::lower",
        "ported/variance_common::variance_from_values",
        "ported/variance_common::stdev_from_values"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/database.rs#L267-L267",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 3 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.DGET.json",
  "name": "DGET",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n### Relationships\n\n\n- **Siblings**: the other eleven database functions, which share the selection stage and reduce\n  the field column instead of selecting from it. Where they answer \"how much\", `DGET` answers\n  \"which\".\n- **Nearest modern equivalents**: `XLOOKUP` and `FILTER`. `FILTER` is the closest in spirit —\n  criteria in, records out — but returns every match as a spilled array rather than insisting on\n  uniqueness. `XLOOKUP` returns the first match and takes a not-found argument. Neither\n  supersedes `DGET`; Excel retains all three.\n- **Confused with**: `VLOOKUP` and `INDEX`/`MATCH`, both of which return the first match without\n  complaint. Replacing `DGET` with `VLOOKUP` to \"fix\" a `#NUM!` discards the very check that was\n  reporting a real ambiguity in the data.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n1. **Count matches before reading any cell.** The uniqueness test governs the whole result, and\n   an implementation that reads the first match eagerly will produce a value where an error is\n   required.\n4. **The two error codes are not interchangeable and are not `#N/A`.** Getting the pair backwards\n   is a silent semantic bug: both are errors, so a naive test that only checks `ISERROR` will\n   not catch it.\n5. **Numeric criteria comparison is not exact double comparison** — see the note in\n   [the shared mechanism](FUNC.DAVERAGE.md#numeric-comparison-is-not-exact-double-comparison).\n   For `DGET` the consequence is sharper than for the aggregates: a tolerant comparison can turn\n   a unique match into a double match, converting a value into `#NUM!`.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns whatever kind the selected cell holds: Number, Text, or Logical.\n\n- **The selected cell holds an error value**: that error is returned. `DGET` passes the cell\n  through rather than diagnosing it.\n- **Text is returned as text.** `DGET` is the only family member that can return a non-numeric\n  result, which matters when its output feeds arithmetic downstream.\n- **Arrays**: inline array literals resolve to grids and are accepted; `DGET` is not a lift\n  kernel, and it never returns an array.\n\n\n\n### Errors\n\n\n| Error | Condition |\n|---|---|\n| `#VALUE!` | No record matches the criteria |\n| `#NUM!` | More than one record matches the criteria |\n| `#VALUE!` | *database* or *criteria* is not a grid or is empty; a database header cell is blank; a criteria header names no database field; *field* matches no header, or is a non-integer or out-of-range column index |\n| propagated | An error value in a header cell or a criteria cell surfaces as that error; an error value in the *selected* cell is returned as the function's result |\n\n",
    "sources": "- Microsoft, \"DGET function\" —\n  <https://support.microsoft.com/en-us/office/dget-function-455568bf-4eef-45f7-90f0-ec250d00892e>\n  (the no-match and multi-match error behaviour).\n- Handbook `CHARTER.md` sections 1, 3 and 7; `content/model/06-claim-language.md`.\n- Handbook call-model chapters 01 and 03 (value kinds, the raw-versus-published boundary, error\n  collapse profiles).\n- [DAVERAGE](FUNC.DAVERAGE.md) — the family's shared criteria-range mechanism.\n- `data/functions/FUNC.DGET.json` (which records `error_collapse_profile: None` for this member\n  alone), `data/presence/FUNC.DGET.json`.\n\n",
    "version-differences": "No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.",
    "what-it-does": "\n`DGET(database, field, criteria)` selects the records of *database* that satisfy *criteria* and\nreturns the value held in the column named by *field* — but only if **exactly one** record\nmatches.\n\n    |R| = 0  →  #VALUE!\n    |R| = 1  →  the value of cell (the matching record, field column)\n    |R| > 1  →  #NUM!\n\nThe uniqueness requirement is the point of the function. `DGET` is a lookup that refuses to\nguess: where `VLOOKUP` silently returns the first of several matches, `DGET` reports that the\nquestion was ambiguous.\n\nThe selection stage — header matching, AND across a criteria row, OR down the rows, blank\ncriteria cells, and criteria-expression parsing — is identical for all twelve database functions\nand is explained once in\n[the criteria-range mechanism](FUNC.DAVERAGE.md#the-criteria-range-mechanism).\n\n\n\n### Arguments\n\n\nThree arguments, all required at the call site; the reference implementation declares an arity\nof exactly 3.\n\n- **`database`** — the header-plus-records range or array.\n- **`field`** — the column selector, as header text or as a 1-based column index within the\n  database range. Required: unlike [DCOUNT](FUNC.DCOUNT.md) and [DCOUNTA](FUNC.DCOUNTA.md),\n  `DGET` has nothing to return without a column.\n- **`criteria`** — the header-plus-conditions range or array. Note the family rule that bites\n  hardest here: a criteria range with no condition rows, or with an all-blank condition row,\n  selects **every** record — so on any database with two or more records that mistake produces\n  `#NUM!`, not the \"first record\" a reader might expect.\n\n\n"
  },
  "signature": {
    "display": "DGET(database, field, criteria)",
    "parameters": [
      {
        "description": null,
        "name": "database",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "field",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "criteria",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 3,
        "min": 3
      },
      "category": "Database functions",
      "classification": {
        "arg_preparation_profile": "RefsVisibleInAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "RefOnly",
        "host_interaction_class": "None",
        "kernel_signature_class": "Custom",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "The one value of a database column that matches the criteria",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Extracts from a database a single record that matches the specified criteria",
        "microsoft_url": "https://support.microsoft.com/en-us/office/dget-function-455568bf-4eef-45f7-90f0-ec250d00892e"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "DGET"
        },
        {
          "locale": "bg-BG",
          "name": "DGET"
        },
        {
          "locale": "cs-CZ",
          "name": "DGET"
        },
        {
          "locale": "da-DK",
          "name": "DHENT"
        },
        {
          "locale": "de-DE",
          "name": "DGET"
        },
        {
          "locale": "el-GR",
          "name": "DGET"
        },
        {
          "locale": "en-AU",
          "name": "DGET"
        },
        {
          "locale": "en-GB",
          "name": "DGET"
        },
        {
          "locale": "en-US",
          "name": "DGET"
        },
        {
          "locale": "es-ES",
          "name": "BDEXTRAER"
        },
        {
          "locale": "et-EE",
          "name": "DGET"
        },
        {
          "locale": "fi-FI",
          "name": "TNOUDA"
        },
        {
          "locale": "fr-FR",
          "name": "BDLIRE*"
        },
        {
          "locale": "he-IL",
          "name": "DGET"
        },
        {
          "locale": "hr-HR",
          "name": "DGET"
        },
        {
          "locale": "hu-HU",
          "name": "AB.MEZŐ"
        },
        {
          "locale": "id-ID",
          "name": "DGET"
        },
        {
          "locale": "it-IT",
          "name": "DGET"
        },
        {
          "locale": "ja-JP",
          "name": "DGET"
        },
        {
          "locale": "ko-KR",
          "name": "DGET"
        },
        {
          "locale": "lt-LT",
          "name": "DGET"
        },
        {
          "locale": "lv-LV",
          "name": "DGET"
        },
        {
          "locale": "nb-NO",
          "name": "DGET"
        },
        {
          "locale": "nl-NL",
          "name": "DBLEZEN"
        },
        {
          "locale": "pl-PL",
          "name": "BD.POLE"
        },
        {
          "locale": "pt-BR",
          "name": "DGET"
        },
        {
          "locale": "pt-PT",
          "name": "BDOBTER"
        },
        {
          "locale": "ro-RO",
          "name": "DGET"
        },
        {
          "locale": "ru-RU",
          "name": "БИЗВЛЕЧЬ"
        },
        {
          "locale": "sk-SK",
          "name": "DGET"
        },
        {
          "locale": "sl-SI",
          "name": "DGET"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "DGET"
        },
        {
          "locale": "sv-SE",
          "name": "DHÄMTA"
        },
        {
          "locale": "th-TH",
          "name": "DGET"
        },
        {
          "locale": "tr-TR",
          "name": "VAL işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "DGET"
        },
        {
          "locale": "vi-VN",
          "name": "DGET"
        },
        {
          "locale": "zh-CN",
          "name": "DGET"
        },
        {
          "locale": "zh-HK",
          "name": "DGET"
        },
        {
          "locale": "zh-TW",
          "name": "DGET"
        }
      ],
      "signature": {
        "display": "DGET(database, field, criteria)",
        "parameters": [
          {
            "description": null,
            "name": "database",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "field",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "criteria",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "DGET",
      "version_marker": null,
      "xlcall": {
        "code": "235",
        "symbol": "xlfDget"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/dget-function-455568bf-4eef-45f7-90f0-ec250d00892e"
  },
  "try_it": {
    "formula": "=DGET(B2:D6,\"Amount\",F2:F3)",
    "inputs": {
      "B2": "Name",
      "B3": "A",
      "B4": "B",
      "B5": "C",
      "B6": "D",
      "C2": "Group",
      "C3": "East",
      "C4": "East",
      "C5": "West",
      "C6": "East",
      "D2": "Amount",
      "D3": 10,
      "D4": 20,
      "D5": 30,
      "D6": 40,
      "F2": "Group",
      "F3": "West"
    }
  },
  "url": "https://handbook.dnacalc.com/functions/DGET.html",
  "variants": [],
  "versions": []
}