Ranking Functions in Excel
Ranking Functions in Excel
Excel Functions: Figure 1 summarizes the various ranking functions available in all
versions of Excel for a data set R. We describe each of these functions in more detail in
the rest of this webpage, plus we describe additional ranking functions that are only
available in Excel 2010/2013.
Observation: All these functions ignore any empty cells and cells with non-numeric
values.
Definition 1: MIN(R) = the smallest value in R and MAX(R) = the largest value in R
MIN(R) = -1
MAX(R) = 7
Definition 2: SMALL(n, R) = the nth smallest value in R and LARGE(n, R) = the nth
largest value in R. Here n can take on any value from 1 to the number of elements in R,
i.e. COUNT(R).
Observation:
SMALL(n, R) = LARGE(COUNT(R) – n + 1, R)
LARGE(n, R) = SMALL(COUNT(R) – n + 1, R)
RANK
RANK(7, R) = RANK(7, R, 0) = 1
RANK(7, R, 1) = 5
RANK(0, R) = RANK(0, R, 0) = 4
RANK(0, R, 1) = 2
Observation:
Observation: Excel’s RANK function does not take care of ties very well. E.g., if the
range R contains the values {1, 5, 5, 0, 8}, then RANK(5, R) = 2 because 5 is the 2 nd
highest ranking element in range R. But 5 is also the 3 rd highest ranking element in the
range, and so for many applications it is useful to consider the ranking to be 2.5, namely
the average of 2 and 3.
To correct for ties for any data element c in the range R, you can use the following
formula (see Built-in Excel Functions for a description of the COUNTIF function):
= RANK(c, R) + (COUNTIF(R, c) – 1) / 2
Excel 2010/2013 Function: Excel 2010/2013 address this issue by providing a new
function RANK.AVG which has the same arguments as RANK but returns the average of
equal ranks as described above. Excel 2010/2013 also provide the function RANK.EQ
which is equivalent to RANK.
Real Statistics Function: For Excel 2007 users the Real Statistics Resource Pack
provides the supplemental function RANK_AVG which is equivalent to RANK.AVG.
Example 4: Using the RANK.AVG or RANK_AVG functions find the ranks of the data
in range E17:E23 of Figure 2.
Figure 2 – Average ranking
The result is shown in column F of Figure 2. E.g. the average rank of 8 (cell E21 or E22)
is 1.5, as calculated using the formula =RANK_AVG(E21,E17:E23) as shown in cell F21
(or F22). If instead you want the ranking in the reverse order (where the lowest value gets
rank 1) then the results are shown in column G. This time using the formula
=RANK_AVG(E21,E17:E23,1) we see that the rank of 8 is 6.5 as shown in cell G21.
Example 5: Calculate the rank and percentile for the following data (using the Excel
2007 definitions of rank and percentile).
For the above data, the tool generates the table in Figure 4.
Figure 4 – Output from Rank and Percentile data analysis tool
The table is sorted in rank order. Point indicates the index of the corresponding score in
the input data range. E.g. 93 is the 9 th data element in the input range, but is the largest
data element and so has rank 1.
PERCENTILE
Example 6: For range R with data elements {4, 0, -1, 7, 5}, the 5 data elements in R
divide the range into 4 intervals of size 25%, i.e. 1/(5-1) = .25. Thus
Example 7: Find the 0 – 100 percentiles in increments of 10% for the data in Figure 3
using both PERCENTILE (or PERCENTILE.INC) and PERCENTILE.EXC.
The result is shown in Figure 5. E.g. the score at the 60th percentile is 58 (cell Z10) using
the formula =PERCENTILE(B3:M3,Y10), while it is 59 (cell AC10) using the formula
=PERCENTILE.EXC(B3:M3,AB10).
PERCENTRANK
PERCENTRANK(R, 5) = .75
PERCENTRANK(R, 54) = .8
You can also add a 3rd argument which represents the number of significant figures in the
answer. Thus PERCENTRANK(R, .85, 5) = .30312
The result is shown in Figure 6. E.g. the score 45 (cell T12) is at the 27.2 th percentile (cell
V12) using the formula =PERCENTRANK(T4:T15,T12), while it is at the 30.7 th
percentile (cell W12) using the formula =PERCENTRANK.EXC(T4:T15,T12).
QUARTILE
Observation:
QUARTILE(R, 0) = PERCENTILE(R, 0) = -1
QUARTILE(R, 1) = PERCENTILE(R, .25) = 0
QUARTILE(R, 2) = PERCENTILE(R, .5) = 4
QUARTILE(R, 3) = PERCENTILE(R, .75) = 5
QUARTILE(R, 4) = PERCENTILE(R, 1) = 7
Excel 2010/2013 Function: Excel 2010/2013 introduce an alternative version of the
quartile function named QUARTILE.EXC. This function is defined so that
QUARTILE.EXC(R, n) = PERCENTILE.EXC(R, n/4).
Excel 2010/2013 also provide the new function QUARTILE.INC which is equivalent to
QUARTILE.
1. David says:
It’s all Greek to me. =.= Allthoug I am interested in this theme. I think I have to
deal a little more closely and intensively to that. So far I am often on tis website to
come closer to my destination, namely to understand excel: http://www.excel-
aid.com/the-excelrank-eq-function.html
Reply