{
  "category": "Compatibility",
  "display_name": "PERCENTILE",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.PERCENTILE",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 6 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 6 recorded answers",
    "workbook_corpus": {
      "cells": 6,
      "matched": 6
    }
  },
  "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/statistics.rs#L302-L302"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/statistics::list",
        "catalogue/statistics::percentile",
        "ported/percentile_common::percentile_inc_kernel",
        "ported/percentile_common::percentile_exc_kernel",
        "ported/percentile_common::interpolate_sorted"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/statistics.rs#L302-L302",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 6 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.PERCENTILE.json",
  "name": "PERCENTILE",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[PERCENTILE.INC](FUNC.PERCENTILE.INC.md) names the inclusive convention explicitly; [PERCENTILE.EXC](FUNC.PERCENTILE.EXC.md) uses the exclusive one. [QUARTILE](FUNC.QUARTILE.md) selects a multiple of one quarter.\n\n\n",
    "how-to-implement": "\n1. Collect the numeric observations using the function’s admission rules and reject an empty set. Validate `0<=k<=1`.\n2. Sort ascending, retaining repeated observations. For one observation, return it.\n3. Form the one-based rank `h=1+k*(n-1)` in the current binary64 operation order.\n4. Let `j=floor(h)`. If the rank is integral, return sorted observation `j`, converting the one-based position to a zero-based index as needed.\n5. Otherwise store `f=h-j` and interpolate `lower+f*(upper-lower)` between observations `j` and `j+1`.\n\nFor four observations and `k=0.25`, `h=1.75`, `f=0.75` and the result is `10+0.75*(20-10)=17.5`. These steps specify the indexing and interpolation. It does not identify every Excel rounding boundary: the current helper uses binary64 arithmetic, and algebraically rearranging the interpolation changes its numerical candidate.\n\n\n",
    "quirks": "\nAn empty numeric set gives `#NUM!`. A fraction outside `[0,1]` gives `#NUM!`; nonnumeric `k` gives `#VALUE!`. Referenced text, logical values and blanks do not become extra numeric observations, while a numeric zero does. Duplicate numbers remain separate observations: do not deduplicate a data set before finding its percentile.\n\nThe current helper returns the sole observation for any admitted `k` when `n=1`. Interpolated answers need not occur in the source data. This is a different operation from returning the nearest observed value or taking a median of hand-selected halves.\n\n\n",
    "sources": "\n- [Microsoft: PERCENTILE function](https://support.microsoft.com/en-us/excel/functions/percentile-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/percentile_common.rs); implementation steps and the limits identified in the text.\n\n",
    "try-it": "\n`=PERCENTILE({10,20,30,40},0.25)` returns `17.5`. Its position is 1.75, between the first and second sorted observations.\n\n`=PERCENTILE({40,10,30,20},0.25)` has the same value: input order does not define the percentile. At `k=0` and `k=1`, the same data returns 10 and 40. The exclusive convention applied at `0.25` returns `12.5`, so the percentile convention is part of the question.\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`PERCENTILE(array,k)` returns a value at a fractional position in sorted numeric observations. This compatibility function uses the inclusive convention: `k=0` is the minimum, `k=1` the maximum, and `k=0.5` the median. Supply a fraction such as `0.25` or a numeric `25%`, not the number 25.\n\n\n"
  },
  "signature": {
    "display": "PERCENTILE(array, k)",
    "parameters": [
      {
        "description": null,
        "name": "array",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "k",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 2,
        "min": 2
      },
      "category": "Compatibility",
      "classification": {
        "arg_preparation_profile": "RefsVisibleInAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "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": "Value at a given percentile, inclusive of 0 and 1 (older form)",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the k-th percentile of values in a range",
        "microsoft_url": "https://support.microsoft.com/en-us/office/percentile-function-91b43a53-543c-4708-93de-d626debdddca"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "PERCENTILE"
        },
        {
          "locale": "bg-BG",
          "name": "PERCENTILE"
        },
        {
          "locale": "cs-CZ",
          "name": "PERCENTIL"
        },
        {
          "locale": "da-DK",
          "name": "FRAKTIL"
        },
        {
          "locale": "de-DE",
          "name": "PERCENTILE"
        },
        {
          "locale": "el-GR",
          "name": "PERCENTILE"
        },
        {
          "locale": "en-AU",
          "name": "PERCENTILE"
        },
        {
          "locale": "en-GB",
          "name": "PERCENTILE"
        },
        {
          "locale": "en-US",
          "name": "PERCENTILE"
        },
        {
          "locale": "es-ES",
          "name": "PERCENTIL"
        },
        {
          "locale": "et-EE",
          "name": "PERCENTILE"
        },
        {
          "locale": "fi-FI",
          "name": "PROSENTTIPISTE"
        },
        {
          "locale": "fr-FR",
          "name": "CENTILE*"
        },
        {
          "locale": "he-IL",
          "name": "PERCENTILE"
        },
        {
          "locale": "hr-HR",
          "name": "PERCENTILE"
        },
        {
          "locale": "hu-HU",
          "name": "PERCENTILIS"
        },
        {
          "locale": "id-ID",
          "name": "PERCENTILE"
        },
        {
          "locale": "it-IT",
          "name": "PERCENTILE"
        },
        {
          "locale": "ja-JP",
          "name": "PERCENTILE"
        },
        {
          "locale": "ko-KR",
          "name": "PERCENTILE"
        },
        {
          "locale": "lt-LT",
          "name": "PERCENTILE"
        },
        {
          "locale": "lv-LV",
          "name": "PERCENTILE"
        },
        {
          "locale": "nb-NO",
          "name": "PERSENTIL"
        },
        {
          "locale": "nl-NL",
          "name": "PERCENTIEL"
        },
        {
          "locale": "pl-PL",
          "name": "PERCENTYL"
        },
        {
          "locale": "pt-BR",
          "name": "PERCENTILE"
        },
        {
          "locale": "pt-PT",
          "name": "PERCENTIL"
        },
        {
          "locale": "ro-RO",
          "name": "PERCENTILE"
        },
        {
          "locale": "ru-RU",
          "name": "ПЕРСЕНТИЛЬ"
        },
        {
          "locale": "sk-SK",
          "name": "PERCENTILE"
        },
        {
          "locale": "sl-SI",
          "name": "PERCENTILE"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "PERCENTIL"
        },
        {
          "locale": "sv-SE",
          "name": "PERCENTIL"
        },
        {
          "locale": "th-TH",
          "name": "PERCENTILE"
        },
        {
          "locale": "tr-TR",
          "name": "YÜZDEBİRLİK işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "PERCENTILE"
        },
        {
          "locale": "vi-VN",
          "name": "PERCENTILE"
        },
        {
          "locale": "zh-CN",
          "name": "PERCENTILE"
        },
        {
          "locale": "zh-HK",
          "name": "PERCENTILE"
        },
        {
          "locale": "zh-TW",
          "name": "PERCENTILE"
        }
      ],
      "signature": {
        "display": "PERCENTILE(array, k)",
        "parameters": [
          {
            "description": null,
            "name": "array",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "k",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "PERCENTILE",
      "version_marker": null,
      "xlcall": {
        "code": "328",
        "symbol": "xlfPercentile"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/percentile-function-91b43a53-543c-4708-93de-d626debdddca"
  },
  "try_it": {
    "formula": "=PERCENTILE({10,20,30,40},0.25)"
  },
  "url": "https://handbook.dnacalc.com/functions/PERCENTILE.html",
  "variants": [],
  "versions": []
}