Percentile Calculator

Paste a data set to find the value at any percentile, or the percentile rank of a particular value, and see which definition is being used and how it compares with Excel.

40th percentile29

Numbers separated by commas, spaces or new lines (up to 10,000).

%

0 – 100

40th percentile

29

  • Rank position h2.6
  • Count (n)5
  • Minimum15
  • Maximum50
  • Methodlinear interpolation, inclusive (R-7, Excel PERCENTILE.INC)
Common percentiles (linear interpolation, inclusive (R-7, Excel PERCENTILE.INC))
PercentileValue
P1017
P2520
P5035
P7540
P9046

Different software uses different percentile definitions, so small data sets can give different answers. The inclusive method matches Excel PERCENTILE.INC, Google Sheets PERCENTILE and R's default (type 7).

How this was calculated

Sorted (n = 5): 15, 20, 35, 40, 50.

Position h = (n − 1)p + 1 = (5 − 1) × 0.4 + 1 = 2.6.

Interpolate: x2 + 0.6 × (x3 − x2) = 20 + 0.6 × (35 − 20) = 29.

Three percentile methods

Sort the n values from smallest to largest and call them x1 … xn. Every method finds a position h in that list and, when h falls between two values, interpolates: P = x⌊h⌋ + (h − ⌊h⌋) × (x⌊h⌋+1 − x⌊h⌋).

The inclusive method (R type 7, Excel PERCENTILE.INC and Google Sheets PERCENTILE) uses h = (n − 1)p + 1, so the 0th percentile is the minimum and the 100th is the maximum. The exclusive method (R type 6, Excel PERCENTILE.EXC) uses h = (n + 1)p and is undefined for percentiles too close to 0 or 100. Nearest rank skips interpolation and takes the value at rank ⌈p × n⌉.

Position of the pth percentile
MethodPosition hAlso called
Inclusive(n − 1)p + 1R-7, PERCENTILE.INC
Exclusive(n + 1)pR-6, PERCENTILE.EXC
Nearest rank⌈p × n⌉no interpolation

Worked example: the 40th percentile

For the data 15, 20, 35, 40, 50 (n = 5) and p = 0.40, the inclusive position is h = 4 × 0.4 + 1 = 2.6. That is 60% of the way from x2 = 20 to x3 = 35, so P40 = 20 + 0.6 × 15 = 29.

The exclusive method gives h = 6 × 0.4 = 2.4 and P40 = 20 + 0.4 × 15 = 26, while nearest rank gives rank ⌈2⌉ = 2 and P40 = 20. On small data sets the choice matters, so match the method your course or software uses.

Percentile rank of a value

The percentile rank answers the reverse question: what share of the data lies below a value? This calculator reports the mid-rank definition (B + E/2) ÷ n × 100, where B is the count below and E the count equal. For 35 in the example above, that is (2 + 0.5) ÷ 5 = 50%.

It also shows the strict share below, the share at or below, and Excel's PERCENTRANK.INC result, which inverts the inclusive percentile method.

How to use the Percentile Calculator

Paste your data, then choose whether you want a percentile or a percentile rank.

  1. Paste the data

    Enter numbers separated by commas, spaces or new lines.

  2. Choose what to find

    Pick the value at a percentile, or the percentile rank of a value.

  3. Choose a method

    Use inclusive to match Excel PERCENTILE.INC, or exclusive or nearest rank to match other conventions.

  4. Read the result

    See the answer, its rank position and the interpolation step.

References

Frequently asked questions

Why do Excel and my textbook give different percentiles?

There are several accepted definitions. Excel's PERCENTILE and PERCENTILE.INC use the inclusive method, while many textbooks use nearest rank or the exclusive method. Choose the matching method here.

Is the 50th percentile the median?

Yes for the inclusive and exclusive methods, which both give the usual median. Nearest rank can give the lower of the two middle values when n is even.

Why does the exclusive method show an error?

It needs at least one value on each side of the percentile position, so for n values it only works between 100/(n + 1) and 100n/(n + 1). Add data or use the inclusive method.

Last updated . Results are estimates for informational purposes only.