{
  "category": "Statistical functions",
  "display_name": "GAMMA.INV",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.GAMMA.INV",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20131",
        "?"
      ],
      "larger_numeric": 7,
      "last_bit": 147,
      "matched": 50,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 204,
      "unread": 0,
      "worst_ulp": 55
    },
    "detail": "Of 209 recorded answers (204 in the answer bank and 5 workbook cells), 155 do not match: 7 differ by more than 16 ULP, 148 differ by at most 16 ULP.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "differs",
    "state_label": "Known larger differences",
    "summary": "Known larger differences on 155 of 209 recorded answers",
    "workbook_corpus": {
      "cells": 5,
      "last_bit": 1,
      "matched": 4,
      "worst_ulp": 2
    }
  },
  "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#L231-L234"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/distributions::nums",
        "ported/beta_gamma_stats_family::validate_gamma_shape",
        "ported/beta_gamma_stats_family::gamma_inv_kernel",
        "ported/excel_numeric::binary_with",
        "ported/excel_numeric::excel_expm1_internal",
        "ported/excel_numeric::expm1_internal_graph",
        "ported/excel_numeric::excel_x87_sub",
        "ported/excel_numeric::excel_x87_mul",
        "ported/excel_numeric::excel_x87_temme_finish",
        "ported/excel_numeric::excel_x87_div",
        "ported/excel_numeric/x87::mul",
        "ported/excel_numeric/x87::sub",
        "ported/excel_numeric/x87::div",
        "ported/excel_numeric/x87_chains::pow2_positive",
        "ported/excel_numeric/x87_chains::pow2",
        "ported/excel_numeric/x87_chains::exp_ext",
        "ported/excel_numeric/x87_chains::exp_with",
        "ported/excel_numeric/x87_chains::excel_exp",
        "ported/excel_numeric/x87_chains::log_with",
        "ported/excel_numeric/x87_chains::excel_log",
        "ported/special_math_common::gratio_norm_gamma",
        "ported/special_math_common::gratio_rexp",
        "ported/special_math_common::gratio_rlog",
        "ported/special_math_common::gratio_gam1",
        "ported/special_math_common::gratio",
        "ported/special_math_common::series_prefactor",
        "ported/special_math_common::gratio_after40",
        "ported/special_math_common::gratio_cf",
        "ported/special_math_common::gratio_temme_270",
        "ported/special_math_common::gratio_temme_340",
        "ported/special_math_common::gratio_temme_330",
        "ported/special_math_common::gratio_temme_finish",
        "ported/special_math_common::regularized_gamma_p",
        "ported/special_math_common::bisect_inverse"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/distributions.rs#L231-L234",
      "state": "differs",
      "suite": null,
      "summary": "Known larger differences on 155 of 209 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.GAMMA.INV.json",
  "name": "GAMMA.INV",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[GAMMA.DIST](FUNC.GAMMA.DIST.md) supplies the forward distribution. [GAMMAINV](FUNC.GAMMAINV.md) is the compatibility spelling. [CHISQ.INV](FUNC.CHISQ.INV.md) uses gamma shape df/2 and scale two; [BETA.INV](FUNC.BETA.INV.md) inverts a bounded distribution.\n\n\n",
    "how-to-implement": "\n1. Validate finite positive alpha and beta and finite p. Return zero for p=0; reject p<0 or p>=1 under the current endpoint rule.\n2. With ordinary binary64 operations, initialize `lo=0` and `hi=beta*max(alpha+10*sqrt(alpha)+10,1)`.\n3. Evaluate `F(x)=regularized_gamma_p(alpha,D(x/beta))`. While F(hi) is below p, double hi. The current source permits 200 expansion checks; extreme-parameter bracketing and nonfinite callbacks remain explicit limitations.\n4. Bisect the nonnegative binary64 encodings of lo and hi, as in the [shared ordered-value inverse recipe](FUNC.CHISQ.INV.RT.md#how-to-implement). If F(mid)>=p keep the midpoint as the upper endpoint; otherwise keep it as lower. Return the upper value when the endpoint encodings are adjacent.\n5. Apply worksheet numeric publication. The candidate searches x on its scaled interval; it does not simply solve once at scale one and multiply an already rounded answer by beta.\n\nFor alpha=1, beta=2 and p=0.5, the mathematical equation gives about `1.38629436111989`. That explains the example. Its numerical candidate still depends on the generic forward callback and upper-adjacent return, rather than an exact inverse exponential formula.\n\nA bracketed Newton method or a residual-based stopping rule is another reasonable mathematical solver. Changing the callback to the public CDF’s special branches is also a separate numerical candidate. Forward-ratio errors, conditioning in the tails, bracket extremes and remaining inverse mismatches remain open; no whole-function Handbook suite is published.\n\n\n",
    "quirks": "\nMicrosoft documents `#VALUE!` for a text argument, `#NUM!` for nonpositive shape or scale and for p outside zero to one. The current helper returns zero at p=0 and `#NUM!` at p=1, where there is no finite mathematical gamma quantile.\n\nThe opened modern page documents an iterative search limit of 64 tries followed by `#N/A`; the legacy GAMMAINV page describes 100 tries. This documentation difference is not a measured change between named Excel builds, and the current helper uses its own bracket and adjacent-value search.\n\nThe current inverse callback is the generic lower gamma ratio. It does not call the public GAMMA.DIST wrapper, whose half-shape and shape-one cases have separate ERF and exponential paths.\n\n\n",
    "sources": "\n- [Microsoft: GAMMA.INV function](https://support.microsoft.com/en-us/excel/functions/gamma-inv-function), opened 7 November 2026; syntax, documented argument rules and errors.\n- [DnaCalc implementation](https://github.com/DnaCalc/DnaCalc/blob/da3ecc4fb19a3a5529708c311d0e8f05688ac165/crates/calc-func/src/ported/beta_gamma_stats_family.rs); implementation steps and the limits identified in the text.\n- [Generic gamma ratio and ordered-value search](https://github.com/DnaCalc/DnaCalc/blob/da3ecc4fb19a3a5529708c311d0e8f05688ac165/crates/calc-func/src/ported/special_math_common.rs); callback and adjacent binary64 return.\n- [Remaining numerical failures](https://github.com/DnaCalc/DnaCalc/blob/da3ecc4fb19a3a5529708c311d0e8f05688ac165/docs/generated/problem-functions.md).\n\n",
    "try-it": "\n`=GAMMA.INV(0.5,1,2)` is about `1.3862943611`. The mathematical shape-one CDF is `1-exp(-x/2)`, so its median solves `x=-2*ln(0.5)`.\n\n`=GAMMA.INV(0.5,1,4)` is about `2.7725887222`. Doubling the scale doubles the mathematical quantile, though the current search has its own stored path.\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| 20131 | Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics | 204 |\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.GAMMA.INV.json).",
    "what-it-does": "\n`GAMMA.INV(probability,alpha,beta)` returns a gamma-distribution quantile for positive shape alpha and positive scale beta. It seeks the x whose lower cumulative probability is the requested p. Beta scales x’s units, rather than supplying an exponential rate.\n\n\n"
  },
  "signature": {
    "display": "GAMMA.INV(probability, alpha, beta)",
    "parameters": [
      {
        "description": null,
        "name": "probability",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "alpha",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "beta",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 3,
        "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": "None",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "The value at which the cumulative gamma distribution reaches a given probability",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the inverse of the gamma cumulative distribution",
        "microsoft_url": "https://support.microsoft.com/en-us/office/gamma-inv-function-74991443-c2b0-4be5-aaab-1aa4d71fbb18"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "GAMMA.INV"
        },
        {
          "locale": "bg-BG",
          "name": "GAMMA.INV"
        },
        {
          "locale": "cs-CZ",
          "name": "GAMMA.INV"
        },
        {
          "locale": "da-DK",
          "name": "GAMMA.INV"
        },
        {
          "locale": "de-DE",
          "name": "GAMMA.INV"
        },
        {
          "locale": "el-GR",
          "name": "GAMMA.INV"
        },
        {
          "locale": "en-AU",
          "name": "GAMMA.INV"
        },
        {
          "locale": "en-GB",
          "name": "GAMMA.INV"
        },
        {
          "locale": "en-US",
          "name": "GAMMA.INV"
        },
        {
          "locale": "es-ES",
          "name": "INV.GAMMA"
        },
        {
          "locale": "et-EE",
          "name": "GAMMA.INV"
        },
        {
          "locale": "fi-FI",
          "name": "GAMMA.JAKAUMA.KÄÄNT"
        },
        {
          "locale": "fr-FR",
          "name": "LOI.GAMMA.INVERSE.N*"
        },
        {
          "locale": "he-IL",
          "name": "GAMMA.INV"
        },
        {
          "locale": "hr-HR",
          "name": "GAMMA.INV"
        },
        {
          "locale": "hu-HU",
          "name": "GAMMA.INVERZ"
        },
        {
          "locale": "id-ID",
          "name": "GAMMA.INV"
        },
        {
          "locale": "it-IT",
          "name": "GAMMA.INV"
        },
        {
          "locale": "ja-JP",
          "name": "GAMMA.INV"
        },
        {
          "locale": "ko-KR",
          "name": "GAMMA.INV"
        },
        {
          "locale": "lt-LT",
          "name": "GAMMA.INV"
        },
        {
          "locale": "lv-LV",
          "name": "GAMMA.INV"
        },
        {
          "locale": "nb-NO",
          "name": "GAMMA.INV"
        },
        {
          "locale": "nl-NL",
          "name": "GAMMA.INV.N"
        },
        {
          "locale": "pl-PL",
          "name": "ROZKŁ.GAMMA.ODWR"
        },
        {
          "locale": "pt-BR",
          "name": "GAMMA.INV"
        },
        {
          "locale": "pt-PT",
          "name": "INV.GAMA"
        },
        {
          "locale": "ro-RO",
          "name": "GAMMA.INV"
        },
        {
          "locale": "ru-RU",
          "name": "ГАММА.ОБР"
        },
        {
          "locale": "sk-SK",
          "name": "GAMMA.INV"
        },
        {
          "locale": "sl-SI",
          "name": "GAMMA.INV"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "GAMMA.INV"
        },
        {
          "locale": "sv-SE",
          "name": "GAMMA.INV"
        },
        {
          "locale": "th-TH",
          "name": "GAMMA.INV"
        },
        {
          "locale": "tr-TR",
          "name": "GAMA.TERS"
        },
        {
          "locale": "uk-UA",
          "name": "GAMMA.INV"
        },
        {
          "locale": "vi-VN",
          "name": "GAMMA.INV"
        },
        {
          "locale": "zh-CN",
          "name": "GAMMA.INV"
        },
        {
          "locale": "zh-HK",
          "name": "GAMMA.INV"
        },
        {
          "locale": "zh-TW",
          "name": "GAMMA.INV"
        }
      ],
      "signature": {
        "display": "GAMMA.INV(probability, alpha, beta)",
        "parameters": [
          {
            "description": null,
            "name": "probability",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "alpha",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "beta",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "GAMMA.INV",
      "version_marker": null,
      "xlcall": {
        "code": "496",
        "symbol": "xlfGamma_inv"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/gamma-inv-function-74991443-c2b0-4be5-aaab-1aa4d71fbb18"
  },
  "try_it": {
    "formula": "=GAMMA.INV(0.5,1,2)"
  },
  "url": "https://handbook.dnacalc.com/functions/GAMMA.INV.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "204 captured inputs are indexed for this environment. Capture dates: 2026-07-17 to 2026-07-17. 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.GAMMA.INV.json"
      ]
    }
  ]
}