{
  "category": "Statistical functions",
  "display_name": "BINOM.DIST.RANGE",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.BINOM.DIST.RANGE",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 1,
      "last_bit": 15,
      "matched": 1208,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 1224,
      "unread": 0,
      "worst_ulp": 19
    },
    "detail": "Of 1,271 recorded answers (1,224 in the answer bank and 47 workbook cells), 16 do not match: 1 differ by more than 16 ULP, 15 differ by at most 16 ULP.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "differs",
    "state_label": "Known larger differences",
    "summary": "Known larger differences on 16 of 1,271 recorded answers",
    "workbook_corpus": {
      "cells": 47,
      "matched": 47
    }
  },
  "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#L269-L273",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/discrete_dist.rs#L196-L220"
      ],
      "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/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#L269-L273",
      "state": "differs",
      "suite": null,
      "summary": "Known larger differences on 16 of 1,271 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.BINOM.DIST.RANGE.json",
  "name": "BINOM.DIST.RANGE",
  "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- **`BINOM.INV`** — the quantile of the same distribution.\n- **`BINOMDIST` / `CRITBINOM`** — the legacy names for the mass/cumulative and quantile forms.\n  `BINOM.DIST.RANGE` has no legacy counterpart; it was introduced with the dotted-name\n  generation, which is why its argument order follows no older convention.\n- **[BETA.DIST](FUNC.BETA.DIST.md)** — the incomplete-beta identity gives a closed-form route to\n  the same interval probability as a difference of two \\(I_p\\) values, which for very wide\n  intervals is \\(O(1)\\) rather than \\(O(s_2-s)\\).\n- **`POISSON.DIST`, `NORM.DIST`** — the limiting approximations, and the usual (inaccurate)\n  substitutes for a wide-interval binomial probability.\n- **Confused with**: `BINOM.DIST` with the arguments in the same order. They are not in the\n  same order. This is the relationship most worth remembering.\n\n\n",
    "how-to-implement": "\n### Numerical notes\n\n\n**Why the function exists.** Given the two cumulative values, the interval probability is their\ndifference. When both are near 1 — an interval in the upper tail — that difference is\ncatastrophic cancellation: two numbers agreeing in the leading digits are subtracted and the\nresult is built entirely from the digits that were least reliable. Summing the interval's own\nmasses instead is a sum of positive quantities, and a sum of positive quantities has no\ncancellation at all. Its relative error is bounded by the ordinary summation bound\n(\\(\\gamma_{m-1}\\) for \\(m\\) terms; Higham, *Accuracy and Stability of Numerical Algorithms*,\nchapter 4), which for realistic interval widths is negligible.\n\nThat is the whole numerical argument for the surface, and it is a good one. It is also why an\nimplementation that quietly computes this function as a difference of CDFs would be *wrong*\nprecisely in the regime the function was added for.\n\n- For `trials` at or below a fixed small threshold, and with \\(p\\) strictly between 0 and 1, it\n  sums masses computed by a **direct combinatoric** form — building \\(C(n,k)\\) by a running\n  product of ratios and multiplying by integer powers of \\(p\\) and \\(q\\).\n- Otherwise it sums masses computed by the general saddle-point path described on\n  [BINOM.DIST](FUNC.BINOM.DIST.md#numerical-notes).\n\n**Cost.** \\(O(s_2 - s)\\) mass evaluations with no shortcut. For a wide interval the\nincomplete-beta route is asymptotically better, and for an interval covering most of the support\nthe complement (1 minus the two excluded tails) is better still — at the cost of reintroducing\nexactly the cancellation this function avoids. There is no universally right choice, which is\nitself worth stating.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns `Number`.\n\n- **`number_s2` omitted.** A single mass. This is the reading most callers do not expect from\n  the function's name, and it is the one that makes `BINOM.DIST.RANGE(n, p, k)` a synonym for\n  `BINOM.DIST(k, n, p, FALSE)` — mathematically. Whether the two are the *same computation* is\n  a separate question; see the numerical notes.\n- **`number_s = 0`, `number_s2 = trials`.** The whole support; the true answer is exactly 1.\n  The best available exactness probe.\n- **`number_s = number_s2`.** A single mass, stated explicitly rather than by omission.\n- **`trials = 0`.** The only admissible interval is \\([0,0]\\), and the answer is 1.\n- **Wide intervals with large `trials`.** The cost is \\(O(s_2 - s)\\) mass evaluations. There is\n  no closed form and no early exit; a range over a million trials is a million evaluations.\n- **Arrays.** The surface lifts natively (`lift_broadcast_profile: surface_native`). There is no\n  legacy alias for this function — it has no pre-2010 counterpart — so the alias questions that\n  attach to the rest of the family do not arise here.\n\n\n\n### Errors\n\n\nAs documented by Microsoft on the `BINOM.DIST.RANGE` page:\n\n| Error | Condition |\n|---|---|\n| `#NUM!` | Any argument is outside its stated constraints |\n| `#VALUE!` | Any argument is non-numeric |\n\nThat is unusually compact for this family: rather than enumerating conditions, the page defers\nto the constraints written into the argument descriptions. Expanded, the `#NUM!` conditions are\n\\(n < 0\\), \\(p < 0\\), \\(p > 1\\), \\(s < 0\\), \\(s > s_2\\), and \\(s_2 > n\\).\n\n",
    "sources": "- Microsoft, \"BINOM.DIST.RANGE function\" —\n  <https://support.microsoft.com/en-us/office/binom-dist-range-function-17331329-74c7-4053-bb4c-6653a7421595>\n  (syntax and argument order; the four argument descriptions with their inline constraints; the\n  out-of-constraint `#NUM!`; the non-numeric `#VALUE!`; the truncation remark; and the summation\n  equation over \\(k\\) from `Number_s` to `Number_s2`).\n- Handbook, [BINOM.DIST](FUNC.BINOM.DIST.md) — the mass algorithm this function sums, and the\n  evidence records that do list a binomial surface among their subjects.\n- M. Abramowitz and I. A. Stegun, *Handbook of Mathematical Functions*, chapter 26.1 (binomial\n  distribution) and 26.5.24 (the incomplete-beta route to binomial tails).\n- N. J. Higham, *Accuracy and Stability of Numerical Algorithms*, 2nd ed., chapter 4 — the\n  summation bound quoted for the positive-terms accumulation.\n- M. Welinder's work on the Gnumeric statistical functions and the published critiques of\n  spreadsheet statistical accuracy.\n- Handbook `CHARTER.md` sections 1, 3 and 7; `content/model/06-claim-language.md`.\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| 20430 | Windows, 64-bit, CPU not recorded | 1,224 |\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.BINOM.DIST.RANGE.json).",
    "what-it-does": "\n`BINOM.DIST.RANGE(trials, probability_s, number_s, [number_s2])` returns the probability that\nthe number of successes in \\(n\\) independent Bernoulli trials falls in a closed interval:\n\n    P(s ≤ X ≤ s₂) = Σ_{k=s}^{s₂} C(n, k) · p^k · (1 − p)^{n−k}\n\nwith \\(n =\\) `trials`, \\(p =\\) `probability_s`, \\(s =\\) `number_s`, \\(s_2 =\\) `number_s2`. When\n`number_s2` is omitted the interval collapses to a point and the function returns the single\nmass \\(b(s; n, p)\\) — the same quantity as `BINOM.DIST(s, n, p, FALSE)`.\n\n**Note the argument order.** `trials` comes *first* here, and `number_s` third. Every other\nbinomial surface in Excel puts the success count first. Transposing the first two arguments by\nhabit produces a call that is usually still valid and always wrong, which makes this the single\nmost error-prone signature in the discrete family.\n\n**Domain.** \\(n \\ge 0\\); \\(0 \\le p \\le 1\\); \\(0 \\le s \\le s_2 \\le n\\); all numeric arguments\ntruncated to integers. Microsoft states each constraint in the argument descriptions themselves\nrather than in the Remarks: `trials` \"Must be greater than or equal to 0\"; `probability_s`\n\"Must be greater than or equal to 0 and less than or equal to 1\"; `number_s` \"Must be greater\nthan or equal to 0 and less than or equal to Trials\"; `number_s2` \"Must be greater than or equal\nto Number_s and less than or equal to Trials\".\n\n**Range.** \\([0, 1]\\), with the value 1 attained exactly when the interval covers the whole\nsupport.\n\n**Identities.**\n\n    BINOM.DIST.RANGE(n, p, s, s₂) = B(s₂; n, p) − B(s−1; n, p)         difference of CDFs\n    BINOM.DIST.RANGE(n, p, s)     = b(s; n, p)                          single mass\n    BINOM.DIST.RANGE(n, p, 0, n)  = 1                                   normalisation\n    BINOM.DIST.RANGE(n, p, s, s₂) = BINOM.DIST.RANGE(n, 1−p, n−s₂, n−s) reflection\n\n\n### Arguments\n\n\n| Argument | Meaning | Admissible | Default |\n|---|---|---|---|\n| `trials` | Number of independent trials | \\(\\ge 0\\), truncated | — |\n| `probability_s` | Success probability per trial | \\(0 \\le p \\le 1\\) | — |\n| `number_s` | Lower end of the success interval | \\(0 \\le s \\le n\\), truncated | — |\n| `number_s2` | Upper end of the interval | \\(s \\le s_2 \\le n\\), truncated | `number_s` |\n\nThere is no `cumulative` flag — the interval form subsumes it.\n\nMicrosoft documents \"Numeric arguments are truncated to integers\", which on this page covers\n`trials`, `number_s` and `number_s2`. `probability_s` is of course not truncated; the sentence\nis a family-wide phrasing rather than a literal claim about every argument.\n\n\n"
  },
  "signature": {
    "display": "BINOM.DIST.RANGE(trials, probability_s, number_s, [number_s2])",
    "parameters": [
      {
        "description": null,
        "name": "trials",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "probability_s",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "number_s",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "number_s2",
        "optional": true,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 4,
        "min": 3
      },
      "category": "Statistical functions",
      "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": "Chance that the number of binomial successes falls between two bounds",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the probability of a trial result using a binomial distribution",
        "microsoft_url": "https://support.microsoft.com/en-us/office/binom-dist-range-function-17331329-74c7-4053-bb4c-6653a7421595"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "bg-BG",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "cs-CZ",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "da-DK",
          "name": "BINOMIAL.DIST.INTERVAL"
        },
        {
          "locale": "de-DE",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "el-GR",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "en-AU",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "en-GB",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "en-US",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "es-ES",
          "name": "DISTR.BINOM.SERIE"
        },
        {
          "locale": "et-EE",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "fi-FI",
          "name": "BINOMI.JAKAUMA.ALUE"
        },
        {
          "locale": "fr-FR",
          "name": "LOI.BINOMIALE.SERIE*"
        },
        {
          "locale": "he-IL",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "hr-HR",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "hu-HU",
          "name": "BINOM.ELOSZL.TART"
        },
        {
          "locale": "id-ID",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "it-IT",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "ja-JP",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "ko-KR",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "lt-LT",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "lv-LV",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "nb-NO",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "nl-NL",
          "name": "BINOM.VERD.BEREIK"
        },
        {
          "locale": "pl-PL",
          "name": "ROZKŁ.DWUM.ZAKRES"
        },
        {
          "locale": "pt-BR",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "pt-PT",
          "name": "DIST.BINOM.INTERVALO"
        },
        {
          "locale": "ro-RO",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "ru-RU",
          "name": "БИНОМ.РАСП.ДИАП"
        },
        {
          "locale": "sk-SK",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "sl-SI",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "sv-SE",
          "name": "BINOM.FÖRD.INTERVALL"
        },
        {
          "locale": "th-TH",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "tr-TR",
          "name": "BİNOM.DAĞ.ARALIK"
        },
        {
          "locale": "uk-UA",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "vi-VN",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "zh-CN",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "zh-HK",
          "name": "BINOM.DIST.RANGE"
        },
        {
          "locale": "zh-TW",
          "name": "BINOM.DIST.RANGE"
        }
      ],
      "signature": {
        "display": "BINOM.DIST.RANGE(trials, probability_s, number_s, [number_s2])",
        "parameters": [
          {
            "description": null,
            "name": "trials",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "probability_s",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "number_s",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "number_s2",
            "optional": true,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "BINOM.DIST.RANGE",
      "version_marker": null,
      "xlcall": {
        "code": "574",
        "symbol": "xlfBinom_dist_range"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/binom-dist-range-function-17331329-74c7-4053-bb4c-6653a7421595"
  },
  "try_it": {
    "formula": "=BINOM.DIST.RANGE(10, 0.5, 3)"
  },
  "url": "https://handbook.dnacalc.com/functions/BINOM.DIST.RANGE.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "1,224 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 20430",
      "platform": "Windows, 64-bit, CPU not recorded",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.BINOM.DIST.RANGE.json"
      ]
    }
  ]
}