Percentile Calculator: Nearest Rank and 3 Linear Interpolation Variants

Percentile Calculator Sign

This calculator will calculate the percentile using 2 main methods; Nearest Rank and Linear Interpolation Between Closest Ranks (3 variants).

Since there is no standard definition of Percentile, I built this calculator based on the methods described on the Percentile page on Wikipedia.org.

Plus, the results include a step-by-step solution to each method and variant, followed by a method comparison chart showing how the methods and variants compare for every 5th percentile in the entered data set.

Note if you wish to calculate a percentile rank, which is different from percentile, please visit the Percentile Rank Calculator

Read more ...

Also on the page:

Percentile Calculator

Calculate percentile using the nearest-rank method and 3 linear interpolation between closest ranks method variants.

Special Instructions

Learn More

Selected Data Record:

A Data Record is a set of calculator entries that are stored in your web browser's Local Storage. If a Data Record is currently selected in the "Data" tab, this line will list the name you gave to that data record. If no data record is selected, or you have no entries stored for this calculator, the line will display "None".

DataData recordData recordSelected data record: None

Load or Clear Sample Entries:

To see how the Percentile Calculator works, select one of the samples to load into the calculator. To clear sample entries, select the "Clear Sample" option.

Enter or paste data set:

Data set:

Enter each element of the data set (or paste a copied data set) into this text box. Be sure each number is separated by a space, a comma, a line return, or any combination of the three.

Percentile:

Percentile:

Enter the percentile you are trying to find. Enter as a percentage without the percent sign (example: to enter the 75th percentile, enter 75).

#
Dec places:Decimal places:Number of decimal places:Number of decimal places to round results to:

Number of decimal places:

Select how many decimal places you would like the results rounded to. Note that you can change the number of places before or after calculating the percentile.

# values (N):# of values (N):Number of values in set (N):Numbers of values in data set (N):

Number of values in data set (N):

This is the total number of values detected in the data set field.

pth Percentile: Method Comparison
Nearest rank:Nearest rank:Nearest rank method:Nearest rank method:

Nearest rank:

This is the value in your data set that corresponds to the entered percentile when applying the Nearest Rank method, which rounds any fractional ordinal rank up to the nearest integer and always yields a result that is found in the data set.

Closest #1 (C=1/2):Closest #1 (C=1/2):Closest rank method, 1st variant (C=1/2):Closest rank method, first variant (C=1/2):

Closest rank method, first variant (C=1/2):

This is the calculated value based on the entered percentile when applying the first variant of the Closest Rank method, which uses linear interpolation to find the fractional percentile position between two percentile positions in the data set.

Closest #2 (C=1):Closest #2 (C=1):Closest rank method, 2nd variant (C=1):Closest rank method, second variant (C=1):

Closest rank method, second variant (C=1):

This is a calculated value based on the entered percentile when applying the second variant of the Closest Rank method, which is based on the Excel PERCENTILE.INC function that includes both endpoints in the calculation and uses linear interpolation to find the fractional percentile position between two percentile ranks in the data set.

Closest #3 (C=0):Closest #3 (C=0):Closet rank method, 3rd variant (C=0):Closest rank method, third variant (C=0):

Closet rank method, third variant (C=0):

This is the calculated value based on the entered percentile when applying the third variant of the Closest rank method, which is based on the Excel PERCENTILE.EXC function that excludes both endpoints calculations and uses linear interpolation to find the fractional percentile position between two percentile ranks in the data set. If the result is "N/A," it means the decimal equivalent of the percentile is smaller than 1/(N+1) or greater than N/(N+1).

If you would like to save the current entries to the secure online database, tap or click on the Data tab, select "New Data Record", give the data record a name, then tap or click the Save button. To save changes to previously saved entries, simply tap the Save button. Please select and "Clear" any data records you no longer need.

Related Calculators

percentile rank calculatorstandard deviation calculatoraverage calculator

Help and Tools

Learn

What percentile means and how is it calculated

What is a Percentile?

A Percentile is a value below which a given percentage of data in a data set falls (exclusive definition) or a value at or below which a given percentage falls (inclusive). For example, the 75th percentile is the value below which (exclusive) or at or below which (inclusive) 75% of the values in the data set may be found.

How to Calculate a Percentile

Since there is no standard percentile formula, I will explain how to calculate percentile using 2 of the most common formulas: Nearest Rank and Closest Rank.

The main difference between the Nearest Rank and Closest Rank methods is how the final value is determined when a rank falls between two data points in the set. Where Nearest Rank rounds up to the next place (always yields a value that exists in the data set), Closest Rank uses various linear interpolation methods to find a value between the closest ranks (value may or may not be a yield a value that exists in the set). I will be covering three of the various interpolation methods in the following example.

Percentile Example

Suppose a class of 20 students take a test, which yields the following test scores:

{45, 65, 74, 82, 64, 91, 78, 87, 85, 79, 94, 59, 83, 86, 69, 84, 89, 78, 81, 77}

Further, suppose you want to calculate the 75th percentile (inclusive), meaning what score represents a point at which 75% of the scores are equal to or less than that value.

Below, I have attempted to show my work for both percentile methods used, including 3 variants of the Closest Rank method. Note that all inter-formula line results are rounded to 4 decimal places, while the final formula lines are rounded to a maximum of 3 places.

The first steps to solving for the percentile for all methods is to sort the data set from smallest to largest and then count the number of values in the set (N). I have sorted the 20 values (N = 20) for you and added a column for Position, which I will refer to in the calculations.

Value
Vi
Position
i
451
592
643
654
695
746
777
788
789
7910
8111
8212
8313
8414
8515
8616
8717
8918
9119
9420

Nearest Rank Method

To solve for the 75th percentile (P) using the Nearest-Rank method, the next step is to find the ordinal rank (n) of the percentile. To find the ordinal rank of the 75th percentile, we use the following formula:

n = P / 100 * N

Substituting the values for the variables gives us the following:

n = 75 / 100 * 20
n = 0.75 * 20
n = 15

Since the ordinal rank is an integer, the Nearest-Rank of the 75th percentile would be the value in the 15th position, which is 85.

Linear Interpolation Between Closest Ranks Method

Three variants based on percentile formulas located on https://en.wikipedia.org/wiki/Percentile.

Closest Rank, First Variant, C=1/2

To solve for the 75th percentile (P) using the Closest-Rank method, the next step is to find the percent rank of each value in the set (Pi). To find the percent rank of each value in the set, we use the formula Pi = 100 / N * (i - 0.5). I have listed the percent rank for each value in the chart below.

Value
Vi
Position
i
Percent
Rank
Pi
4512.50
5927.50
64312.500
65417.500
69522.500
74627.500
77732.500
78837.500
78942.500
791047.500
811152.500
821257.500
831362.500
841467.500
851572.500
861677.500
871782.500
891887.500
911992.500
942097.500

We then check to see which one of the following conditions apply:

  1. Is P < P1? If yes, the answer is the value at position 1 (P1).
  2. Is P > Pn? If yes, the answer is the value at the last position (Pn).
  3. Is P equal to any Pi? If yes, the answer is the value at position where the percentile equals the percent rank.
  4. None of the above. If true, we need to use linear interpolation to find the percentile value, so we find the first percent rank that is greater than the percentile and note that position (Pi), along with the position just before it (Pi-1) and solve the following linear interpolation formula where the values vi and vi-1 correlate to those positions.

    v = vi-1 + (N * ((P - Pi-1) / 100) * (vi - vi-1))

In this case, since condition #4 is true, we plug the variables (N = 20, P = 75, Pi-1 = 72.5, vi = 86, vi-1 = 85) into the above formula and solve the formula.

v = 85 + (20 * ((75 - 72.5) / 100) * (86 - 85))
v = 85 + (20 * (2.5 / 100) * 1)
v = 85 + (20 * 0.025 * 1)
v = 85 + (0.5 * 1)
v = 85 + 0.5
v = 85.5

Closest Rank, Second Variant, C=1

To solve for the 75th percentile (P) using the Excel PERCENTILE.INC () method, the first step is to calculate the rank (r) of the 75th percentile using the following formula:

r = (P / 100) * (N -1) + 1

Substituing the variables (P = 75, N = 20) into the rank formula gives us a rank of 15.25, shown as follows:

r = (75 / 100) * (20 - 1) + 1
r = 0.75 * 19 + 1
r = 14.25 + 1
r = 15.25

Next, since the rank (15.25) is not an integer, we need to use linear interpolation to find the 75th percentile value. So, we let the fractional portion of the rank equal rf, the integer portion of the rank equal to v15, and v16 equal to v15 + 1, and use those variables to solve the following interpolation formula:

v(r) = v15 + rf (v16 - v15)

Substituing the variables (rf = 0.25, v15 = 85, v16 = 86) into that formula gives us a 75th percentile value of 85.25, shown as follows:

v(15.25) = 85 + (0.25 * (86 - 85))
v(15.25) = 85 + (0.25 * 171)
v(15.25) = 85 + 42.75
v(15.25) = 85.25

Closest Rank, Third Variant, C=0

To solve for the 75th percentile (P) using the Excel PERCENTILE.EXC () method (excludes both endpoints of the range), the first step is to calculate the rank (r) of the 75th percentile using the following formula:

r = (P / 100) * (N + 1)

Substituing the variables (P = 75, N = 20) into the rank formula gives us a rank of 15.75, shown as follows:

r = (75 / 100) * (20 + 1)
r = 0.75 * 21
r = 15.75

Next, since the rank is not an integer, we need to use linear interpolation to find the 75th percentile, so we let the fractional portion of the rank equal rf, the integer portion of the rank equal to v15, and v16 equal to v15 + 1, and use those variables to solve the following interpolation formula:

v(r) = v15 + rf (v16 - v15)

Substituing the variables (rf = 0.75, v15 = 85, v16 = 86) into that formula gives us a 75th percentile value of 85.75, shown as follows:

v(15.75) = 85 + (0.75 * (86 - 85))
v(15.75) = 85 + (0.75 * 1)
v(15.75) = 85 + 0.75
v(15.75) = 85.75

Percentile Method Comparision

The following table shows the comparison of the percentile methods and variants for every 5th percentile for the example data set:

{45, 59, 64, 65, 69, 74, 77, 78, 78, 79, 81, 82, 83, 84, 85, 86, 87, 89, 91, 94}

PercentileNRC=1/2C=1C=0
0th454545N/A
5th455258.345.7
10th5961.563.559.5
15th6464.564.8564.15
20th656768.265.8
1st Quartile 25th6971.572.7570.25
30th7475.576.174.9
35th7777.577.6577.35
40th78787878
45th7878.578.5578.45
2nd Quartile 50th79808080
55th8181.581.4581.55
60th8282.582.482.6
65th8383.583.3583.65
70th8484.584.384.7
3rd Quartile 75th8585.585.2585.75
80th8686.586.286.8
85th878887.388.7
90th899089.290.8
95th9192.591.1593.85
100th949494N/A

Adjust Calculator Width:

Move the slider to left and right to adjust the calculator width. Note that the Help and Tools panel will be hidden when the calculator is too wide to fit both on the screen. Moving the slider to the left will bring the instructions and tools panel back into view.

Also note that some calculators will reformat to accommodate the screen size as you make the calculator wider or narrower. If the calculator is narrow, columns of entry rows will be converted to a vertical entry form, whereas a wider calculator will display columns of entry rows, and the entry fields will be smaller in size ... since they will not need to be "thumb friendly".

Show/Hide Popup Keypads:

Select Show or Hide to show or hide the popup keypad icons located next to numeric entry fields. These are generally only needed for mobile devices that don't have decimal points in their numeric keypads. So if you are on a desktop, you may find the calculator to be more user-friendly and less cluttered without them.

Stick/Unstick Tools:

Select Stick or Unstick to stick or unstick the help and tools panel. Selecting "Stick" will keep the panel in view while scrolling the calculator vertically. If you find that annoying, select "Unstick" to keep the panel in a stationary position.

If the tools panel becomes "Unstuck" on its own, try clicking "Unstick" and then "Stick" to re-stick the panel.