{
  "category": "Database functions",
  "display_name": "DPRODUCT",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.DPRODUCT",
  "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#L270-L270"
      ],
      "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#L270-L270",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 3 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.DPRODUCT.json",
  "name": "DPRODUCT",
  "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- **[DSUM](FUNC.DSUM.md)** is the additive counterpart, with the same skip policy and the same\n  empty-selection zero — which is the correct additive identity there and the wrong\n  multiplicative one here.\n- **Nearest equivalent**: `PRODUCT` combined with `IF`, entered as an array formula, or\n  `EXP(SUMIFS(LN(...)))` for strictly positive data. Excel has no `PRODUCTIFS`, which makes\n  `DPRODUCT` the only criteria-driven product in the worksheet surface — a genuinely unique role\n  in the function catalogue.\n- **Confused with**: `PRODUCT` (no selection stage) and `SUMPRODUCT` (which sums products across\n  columns rather than multiplying down one).\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n\n1. **Reduction order is observable.** The family declares a sequential left fold. Floating-point\n   multiplication is not associative, so a reassociated or pairwise product will differ in the\n   last bits, and on values near the representable range the *order alone* can decide whether an\n   intermediate overflows.\n2. **The empty-selection zero must be special-cased.** A fold with initial value `1` gives `1`\n   for an empty list, which is mathematically right and behaviourally wrong here. Branch on\n   emptiness explicitly.\n3. **Skip, do not coerce.** Admit only cells whose value kind is Number. Coercing blanks to zero\n   would turn most real columns into `0`.\n4. **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\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns a Number.\n\n- **No numeric value selected**: `0`. See above; this is the convention, not the empty product.\n- **A single matching value**: that value, unchanged.\n- **A zero anywhere in the value list**: `0`, for the ordinary reason.\n- **Overflow.** Products grow fast. The family's declared real-result policy is\n  `non_finite=allow` with no argument-domain guard, meaning the reference implementation does\n  not itself convert an overflowing product to `#NUM!` — see\n  [result publication](../model/03-call-pipeline.md#stage-4-result-publication) for what that\n  axis means. What Excel publishes for an overflowing `DPRODUCT` is unchecked, and it is the\n  most consequential open question on this page.\n- **Text that looks numeric in the field column** is skipped, per the range-scan side of the\n  asymmetry in\n  [coercion and lifting](../model/02-coercion-and-lifting.md#direct-arguments-versus-range-scans).\n- **Logicals in the field column** are skipped, so `TRUE` never contributes a factor of 1 and\n  `FALSE` never annihilates the product.\n- **Arrays**: inline array literals resolve to grids and are accepted; `DPRODUCT` is not a lift\n  kernel.\n\n\n\n### Errors\n\n\n| Error | Condition |\n|---|---|\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, a criteria cell, or a scanned field cell surfaces as that error |\n\n",
    "sources": "- Microsoft, \"DPRODUCT function\" —\n  <https://support.microsoft.com/en-us/office/dproduct-function-4f96b13e-d49c-47a7-b769-22f6d017cb31>\n- Handbook `CHARTER.md` sections 1, 3 and 7; `content/model/06-claim-language.md`.\n- Handbook call-model chapters 02 and 03 (range-scan coercion, error folding, result\n  publication and the non-finite axis).\n- [DAVERAGE](FUNC.DAVERAGE.md) — the family's shared criteria-range mechanism.\n- `data/functions/FUNC.DPRODUCT.json` (real-result policy: no argument-domain guard,\n  non-finite allowed), `data/presence/FUNC.DPRODUCT.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`DPRODUCT(database, field, criteria)` selects the records of *database* that satisfy *criteria*,\nreads the column named by *field*, and returns the product of the numeric values found there.\n\nWith R the set of selected record rows, c the resolved field column, and\n\n    V = [ v : v = value of cell (r, c) for r in R, in record order, where v is a Number ]\n\nNon-numeric cells in the field column contribute nothing: text (including text that reads as a\nnumber), logicals, and blanks are skipped rather than coerced. Note the asymmetry with\n[DSUM](FUNC.DSUM.md): skipping a cell is the same as adding zero for a sum, but it is *not* the\nsame as multiplying by one — it is what makes the product well-defined at all, since coercing a\nblank to zero would annihilate every result containing one.\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.\n- **`criteria`** — the header-plus-conditions range or array.\n\n\n"
  },
  "signature": {
    "display": "DPRODUCT(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": "ReductionFold",
        "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": "Product of a database column over the matching records",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Multiplies the values in a particular field of records that match the criteria in a database",
        "microsoft_url": "https://support.microsoft.com/en-us/office/dproduct-function-4f96b13e-d49c-47a7-b769-22f6d017cb31"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "DPRODUCT"
        },
        {
          "locale": "bg-BG",
          "name": "DPRODUCT"
        },
        {
          "locale": "cs-CZ",
          "name": "DSOUČIN"
        },
        {
          "locale": "da-DK",
          "name": "DPRODUKT"
        },
        {
          "locale": "de-DE",
          "name": "DPRODUCT"
        },
        {
          "locale": "el-GR",
          "name": "DPRODUCT"
        },
        {
          "locale": "en-AU",
          "name": "DPRODUCT"
        },
        {
          "locale": "en-GB",
          "name": "DPRODUCT"
        },
        {
          "locale": "en-US",
          "name": "DPRODUCT"
        },
        {
          "locale": "es-ES",
          "name": "BDPRODUCTO"
        },
        {
          "locale": "et-EE",
          "name": "DPRODUCT"
        },
        {
          "locale": "fi-FI",
          "name": "TTULO"
        },
        {
          "locale": "fr-FR",
          "name": "BDPRODUIT*"
        },
        {
          "locale": "he-IL",
          "name": "DPRODUCT"
        },
        {
          "locale": "hr-HR",
          "name": "DPRODUCT"
        },
        {
          "locale": "hu-HU",
          "name": "AB.SZORZAT"
        },
        {
          "locale": "id-ID",
          "name": "DPRODUCT"
        },
        {
          "locale": "it-IT",
          "name": "DPRODUCT"
        },
        {
          "locale": "ja-JP",
          "name": "DPRODUCT"
        },
        {
          "locale": "ko-KR",
          "name": "DPRODUCT"
        },
        {
          "locale": "lt-LT",
          "name": "DPRODUCT"
        },
        {
          "locale": "lv-LV",
          "name": "DPRODUCT"
        },
        {
          "locale": "nb-NO",
          "name": "DPRODUKT"
        },
        {
          "locale": "nl-NL",
          "name": "DBPRODUCT"
        },
        {
          "locale": "pl-PL",
          "name": "BD.ILOCZYN"
        },
        {
          "locale": "pt-BR",
          "name": "DPRODUCT"
        },
        {
          "locale": "pt-PT",
          "name": "BDMULTIPL"
        },
        {
          "locale": "ro-RO",
          "name": "DPRODUCT"
        },
        {
          "locale": "ru-RU",
          "name": "БДПРОИЗВЕД"
        },
        {
          "locale": "sk-SK",
          "name": "DPRODUCT"
        },
        {
          "locale": "sl-SI",
          "name": "DPRODUCT"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "DPRODUCT"
        },
        {
          "locale": "sv-SE",
          "name": "DPRODUKT"
        },
        {
          "locale": "th-TH",
          "name": "DPRODUCT"
        },
        {
          "locale": "tr-TR",
          "name": "VSEÇÇARP işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "DPRODUCT"
        },
        {
          "locale": "vi-VN",
          "name": "DPRODUCT"
        },
        {
          "locale": "zh-CN",
          "name": "DPRODUCT"
        },
        {
          "locale": "zh-HK",
          "name": "DPRODUCT"
        },
        {
          "locale": "zh-TW",
          "name": "DPRODUCT"
        }
      ],
      "signature": {
        "display": "DPRODUCT(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": "DPRODUCT",
      "version_marker": null,
      "xlcall": {
        "code": "189",
        "symbol": "xlfDproduct"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/dproduct-function-4f96b13e-d49c-47a7-b769-22f6d017cb31"
  },
  "try_it": {
    "formula": "=DPRODUCT(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": "East"
    }
  },
  "url": "https://handbook.dnacalc.com/functions/DPRODUCT.html",
  "variants": [],
  "versions": []
}