{
  "category": "Compatibility",
  "display_name": "HYPGEOMDIST",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.HYPGEOMDIST",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20131",
        "?"
      ],
      "larger_numeric": 0,
      "last_bit": 3,
      "matched": 0,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 3,
      "unread": 0,
      "worst_ulp": 2
    },
    "detail": "Everything else matches (3 in the answer bank and 6 workbook cells). Last-bit means a finite number within 16 ULP of Excel's.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "close",
    "state_label": "Close: last-bit deviations remain",
    "summary": "Close: 5 of 9 recorded answers differ in the last bits, worst 2 ULP",
    "workbook_corpus": {
      "cells": 6,
      "last_bit": 2,
      "matched": 4,
      "worst_ulp": 1
    }
  },
  "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/distributions.rs#L294-L297"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/distributions::nums",
        "ported/discrete_dist::stirling_error",
        "ported/discrete_dist::deviance",
        "ported/discrete_dist::binom_mass",
        "ported/discrete_dist::finite",
        "ported/discrete_dist::hypergeom_mass",
        "ported/discrete_dist::hypergeom_dist_kernel",
        "ported/excel_numeric::binary_with",
        "ported/excel_numeric::excel_x87_add",
        "ported/excel_numeric::excel_x87_sub",
        "ported/excel_numeric::excel_x87_mul",
        "ported/excel_numeric::excel_x87_div",
        "ported/excel_numeric/x87::mul",
        "ported/excel_numeric/x87::add",
        "ported/excel_numeric/x87::sub",
        "ported/excel_numeric/x87::div"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/distributions.rs#L294-L297",
      "state": "close",
      "suite": null,
      "summary": "Close: 5 of 9 recorded answers differ in the last bits, worst 2 ULP"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.HYPGEOMDIST.json",
  "name": "HYPGEOMDIST",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[BINOM.DIST](FUNC.BINOM.DIST.md) models independent trials with replacement; [COMBIN](FUNC.COMBIN.md) counts combinations; [HYPGEOM.DIST](FUNC.HYPGEOM.DIST.md) exposes the cumulative switch.\n\n\n",
    "how-to-implement": "\nThe mathematical probability is `choose(K,k)*choose(N-K,n-k)/choose(N,n)`. For one success in a sample of two from five objects with three successes, the numerator is `3*2=6` and the denominator ten, giving `0.6`.\n\nThe current wrapper calls the same mass helper as [HYPGEOM.DIST with cumulative FALSE](FUNC.HYPGEOM.DIST.md#how-to-implement). It rejects original negative signs, truncates the counts, checks `n<=N` and `K<=N`, then applies the mass support and degenerate-sample rules. For nondegenerate supported counts it forms `p=n/N` and `q=(N-n)/N`, obtains three binomial masses, and returns their product/ratio in the stated order. There is no cumulative switch or cumulative endpoint shortcut on this spelling.\n\nRatios of integer combinations or a recurrence give alternative mathematical algorithms. They avoid separately overflowing factorials, but do not identify Excel’s numerical leaves or error order. The generated fingerprint report still has no adopted complete hypergeometric algorithm; legacy-spelling boundaries and remaining numerical differences stay open.\n\n\n",
    "quirks": "\nThe four arguments are counts and are truncated toward zero, with the current code rejecting original negative signs before truncation. The feasible success interval is `max(0,n-(N-K))..min(n,K)`, where `n` is sample size, `K` population successes and `N` population size.\n\nMicrosoft’s documented guard gives `#NUM!` for invalid sizes and success counts; nonnumeric arguments give `#VALUE!`. The current shared mass helper instead supplies zero for an unsupported success count and handles an empty sample as a degenerate mass. The modern HYPGEOM.DIST has retained build 20430 controls for such departures, but those calls do not measure this legacy spelling. Keep that remaining scope explicit.\n\n\n",
    "sources": "\n- [Microsoft: HYPGEOMDIST function](https://support.microsoft.com/en-us/excel/functions/hypgeomdist-function), opened 6 November 2026; syntax, documented argument rules and errors.\n- [DnaCalc implementation](https://github.com/DnaCalc/DnaCalc/blob/da3ecc4fb19a3a5529708c311d0e8f05688ac165/crates/calc-func/src/ported/discrete_dist.rs); implementation steps and the limits identified in the text.\n\n",
    "try-it": "\n`=HYPGEOMDIST(1,2,3,5)` is about `0.6`. Drawing two objects from five, three marked successful, yields one success in `choose(3,1)*choose(2,1)=6` of `choose(5,2)=10` possible samples.\n\n\n",
    "version-differences": "The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.\n\n| Excel 16.0 build | Platform and CPU | Captured inputs |\n|---|---|---:|\n| 19929 | Windows, bitness not recorded, CPU not recorded | 46 |\n| 20131 | Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics | 3 |\n\nThe record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.\n\n[Recorded environments and comparison details](https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.HYPGEOMDIST.json).",
    "what-it-does": "\n`HYPGEOMDIST(sample_s, number_sample, population_s, number_pop)` models sampling **without replacement**. It counts successes in a fixed sample drawn from a finite population.This compatibility form returns a mass only.\n\n\n"
  },
  "signature": {
    "display": "HYPGEOMDIST(sample_s, number_sample, population_s, number_pop)",
    "parameters": [
      {
        "description": null,
        "name": "sample_s",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "number_sample",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "population_s",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "number_pop",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 4,
        "min": 4
      },
      "category": "Compatibility",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "None",
        "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": "Hypergeometric probability (older form)",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the hypergeometric distribution",
        "microsoft_url": "https://support.microsoft.com/en-us/office/hypgeomdist-function-23e37961-2871-4195-9629-d0b2c108a12e"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "bg-BG",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "cs-CZ",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "da-DK",
          "name": "HYPGEOFORDELING"
        },
        {
          "locale": "de-DE",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "el-GR",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "en-AU",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "en-GB",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "en-US",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "es-ES",
          "name": "DISTR.HIPERGEOM"
        },
        {
          "locale": "et-EE",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "fi-FI",
          "name": "HYPERGEOM.JAKAUMA"
        },
        {
          "locale": "fr-FR",
          "name": "LOI.HYPERGEOMETRIQUE*"
        },
        {
          "locale": "he-IL",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "hr-HR",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "hu-HU",
          "name": "HIPERGEOM.ELOSZLÁS"
        },
        {
          "locale": "id-ID",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "it-IT",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "ja-JP",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "ko-KR",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "lt-LT",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "lv-LV",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "nb-NO",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "nl-NL",
          "name": "HYPERGEO.VERD"
        },
        {
          "locale": "pl-PL",
          "name": "ROZKŁAD.HIPERGEOM"
        },
        {
          "locale": "pt-BR",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "pt-PT",
          "name": "DIST.HIPERGEOM"
        },
        {
          "locale": "ro-RO",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "ru-RU",
          "name": "ГИПЕРГЕОМЕТ"
        },
        {
          "locale": "sk-SK",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "sl-SI",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "sv-SE",
          "name": "HYPGEOMFÖRD"
        },
        {
          "locale": "th-TH",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "tr-TR",
          "name": "HİPERGEOMDAĞ işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "vi-VN",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "zh-CN",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "zh-HK",
          "name": "HYPGEOMDIST"
        },
        {
          "locale": "zh-TW",
          "name": "HYPGEOMDIST"
        }
      ],
      "signature": {
        "display": "HYPGEOMDIST(sample_s, number_sample, population_s, number_pop)",
        "parameters": [
          {
            "description": null,
            "name": "sample_s",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "number_sample",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "population_s",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "number_pop",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "HYPGEOMDIST",
      "version_marker": null,
      "xlcall": {
        "code": "289",
        "symbol": "xlfHypgeomdist"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/hypgeomdist-function-23e37961-2871-4195-9629-d0b2c108a12e"
  },
  "try_it": {
    "formula": "=HYPGEOMDIST(1,2,3,5)"
  },
  "url": "https://handbook.dnacalc.com/functions/HYPGEOMDIST.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "46 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 19929",
      "platform": "Windows, bitness not recorded, CPU not recorded",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.HYPGEOMDIST.json"
      ]
    },
    {
      "behaviour": "3 captured inputs are indexed for this environment. Capture dates: 2026-07-16 to 2026-07-16. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 20131",
      "platform": "Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.HYPGEOMDIST.json"
      ]
    }
  ]
}