{
  "category": "Statistical functions",
  "display_name": "CHISQ.INV.RT",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.CHISQ.INV.RT",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 4 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 4 recorded answers",
    "workbook_corpus": {
      "cells": 4,
      "matched": 4
    }
  },
  "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#L128-L131"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/distributions::nums",
        "ported/chi_f_t_family::truncate_positive_integer",
        "ported/chi_f_t_family::validate_probability_open_unit",
        "ported/chi_f_t_family::search_upper_bound",
        "ported/chi_f_t_family::chisq_inv_rt_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_q",
        "ported/special_math_common::bisect_inverse"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/distributions.rs#L128-L131",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 4 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.CHISQ.INV.RT.json",
  "name": "CHISQ.INV.RT",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[CHISQ.DIST.RT](FUNC.CHISQ.DIST.RT.md) supplies the forward probability; [CHISQ.TEST](FUNC.CHISQ.TEST.md) returns a test p-value directly.\n\n\n",
    "how-to-implement": "\nThe current candidate inverts the decreasing regularized upper gamma ratio `Q(k/2,x/2)` directly. Do not first replace p by `1-p`: a tiny p can disappear in that subtraction.\n\n1. Truncate and validate k and require `0<p<1`. Let `H(x)=-Q(k/2,x/2)` and `target=-p`, making H increasing.\n2. Set `lo=0,hi=max(k,1)`. While `H(hi)<target`, double hi, with the source’s limit of 200 expansion checks.\n3. For nonnegative finite binary64 values, their unsigned 64-bit encodings have the same order as their values. Let L and U be the encodings of lo and hi. While `U-L>1`, take the integer midpoint `M=L+(U-L)//2`, decode it to x, and evaluate H(x). If `H(x)>=target`, set U=M; otherwise set L=M.\n4. Decode and return U. This chooses the upper endpoint of the maintained adjacent-value bracket, rather than a floating arithmetic midpoint or a nearest-root rounding rule.\n\nAt k=2 the mathematical right tail is `exp(-x/2)`. Setting it to one half gives about `1.38629436111989`. In the current code, however, this inverse callback remains the generic upper-gamma ratio; it does not call the public right-tail wrapper’s separate df=1 ERFC and df=2 EXP branches.\n\nThis is an implementable description of the current search, conditional on its numerical forward callback. That callback’s approximation and monotonic behaviour, its remaining mismatches and whole-domain Excel return choices are separate unresolved questions.\n\n\n",
    "quirks": "\nDegrees of freedom are truncated. Nonnumeric arguments give `#VALUE!`; invalid degrees or probabilities give `#NUM!`. The current helper accepts truncated degrees from one through `10^10` and requires `0<p<1`; it rejects both probability endpoints.\n\nThe opened Microsoft page describes an out-of-range probability test below zero or above one, and degrees below one. It also documents `#N/A` after 64 unsuccessful search iterations. Those statements are documentation, rather than evidence that the current shared search has the same guards or iteration counter. The companion legacy CHIINV page documents 100 iterations; this wording difference does not establish a measured change between Excel builds.\n\n\n",
    "sources": "\n- [Microsoft: CHISQ.INV.RT function](https://support.microsoft.com/en-us/excel/functions/chisq-inv-rt-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/chi_f_t_family.rs); implementation steps and the limits identified in the text.\n- [Ordered-value inverse search](https://github.com/DnaCalc/DnaCalc/blob/da3ecc4fb19a3a5529708c311d0e8f05688ac165/crates/calc-func/src/ported/special_math_common.rs); `bisect_inverse`, upper-gamma callback and numerical limits.\n\n",
    "try-it": "\n`=CHISQ.INV.RT(0.5,2)` is about `1.38629436111989`. At two degrees of freedom, a half right tail solves `exp(-x/2)=0.5`; the same point also has a half left CDF.\n\n\n",
    "version-differences": "\nNo same-input comparison between named Excel builds is recorded for this function here. The documented behaviour below is not a measurement of every Excel release.\n\n\n",
    "what-it-does": "\n`CHISQ.INV.RT(probability, deg_freedom)` finds the chi-square value whose right-tail probability is the requested value.\n\n\n"
  },
  "signature": {
    "display": "CHISQ.INV.RT(probability, deg_freedom)",
    "parameters": [
      {
        "description": null,
        "name": "probability",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "deg_freedom",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 2,
        "min": 2
      },
      "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": "The value at which the right-tail chi-squared probability falls to a given level",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the inverse of the one-tailed probability of the chi-squared distribution",
        "microsoft_url": "https://support.microsoft.com/en-us/office/chisq-inv-rt-function-435b5ed8-98d5-4da6-823f-293e2cbc94fe"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "bg-BG",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "cs-CZ",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "da-DK",
          "name": "CHI2.INV.RT"
        },
        {
          "locale": "de-DE",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "el-GR",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "en-AU",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "en-GB",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "en-US",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "es-ES",
          "name": "INV.CHICUAD.CD"
        },
        {
          "locale": "et-EE",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "fi-FI",
          "name": "CHINELIÖ.KÄÄNT.OH"
        },
        {
          "locale": "fr-FR",
          "name": "LOI.KHIDEUX.INVERSE.DROITE*"
        },
        {
          "locale": "he-IL",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "hr-HR",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "hu-HU",
          "name": "KHINÉGYZET.INVERZ.JOBB"
        },
        {
          "locale": "id-ID",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "it-IT",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "ja-JP",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "ko-KR",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "lt-LT",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "lv-LV",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "nb-NO",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "nl-NL",
          "name": "CHIKW.INV.RECHTS"
        },
        {
          "locale": "pl-PL",
          "name": "ROZKŁ.CHI.ODWR.PS"
        },
        {
          "locale": "pt-BR",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "pt-PT",
          "name": "INV.CHIQ.DIR"
        },
        {
          "locale": "ro-RO",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "ru-RU",
          "name": "ХИ2.ОБР.ПХ"
        },
        {
          "locale": "sk-SK",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "sl-SI",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "sv-SE",
          "name": "CHI2.INV.RT"
        },
        {
          "locale": "th-TH",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "tr-TR",
          "name": "KİKARE.TERS.SAĞK"
        },
        {
          "locale": "uk-UA",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "vi-VN",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "zh-CN",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "zh-HK",
          "name": "CHISQ.INV.RT"
        },
        {
          "locale": "zh-TW",
          "name": "CHISQ.INV.RT"
        }
      ],
      "signature": {
        "display": "CHISQ.INV.RT(probability, deg_freedom)",
        "parameters": [
          {
            "description": null,
            "name": "probability",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "deg_freedom",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "CHISQ.INV.RT",
      "version_marker": null,
      "xlcall": {
        "code": "530",
        "symbol": "xlfChisq_inv_rt"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/chisq-inv-rt-function-435b5ed8-98d5-4da6-823f-293e2cbc94fe"
  },
  "try_it": {
    "formula": "=CHISQ.INV.RT(0.5,2)"
  },
  "url": "https://handbook.dnacalc.com/functions/CHISQ.INV.RT.html",
  "variants": [],
  "versions": []
}