How to use the RANK.EQ function
What is the RANK.EQ function?
The RANK.EQ function calculates the rank of a number in a list of numbers, based on its position if the list were sorted. The top rank is returned if more than one number share the same rank.
The RANK.EQ and RANK.AVG function replaces the RANK function.
Table of Contents
1. Introduction
What is ranking a number?
Ranking a number means determining its position or order when arranged with other numbers in a dataset. The rank provides information about where a value stands relative to others.
For example, ten students had the following test scores: 66, 97, 99, 77, 9, 60, 35, 60, 61, and 57
If we sort the numbers from largest to smallest we get: 99, 97, 77, 66, 61, 60, 60, 35, 9 We can now rank the numbers based on size which I have done in cells D3:D11, however, the RANK.EQ function does not rank numbers like the image demonstrates above. Example 3 below shows how to return unique ranks.
When is it useful in statistics to rank a number?
One example is finding out the standing of an exam score in comparison to all students. Determining the rank is needed to find out the standing relative to the other students.
Another examples is that outliers are often ranked at the extremes.
What are outliers?
Outliers in statistics are observations that differ significantly from other observations in a dataset. They are data points that stand apart from the overall pattern.
What are the differences between RANK.AVG and the RANK.EQ functions?
The RANK.AVG function returns the average rank if more than one item share the same rank, the RANK.EQ function returns the top rank if more than one item share the same rank.
2. RANK.EQ Function Syntax
RANK.EQ(number,ref,[order])
3. RANK.EQ Function Arguments
number | Required. |
ref | Required. A list of numbers. |
[order] | Optional. This argument determines how the RANK.EQ function ranks a number.
0 (zero) - Default value, list in argument ref is sorted in a descending order. 1 - List in argument ref is sorted in an ascending order. |
What is descending order?
Descending order refers to arranging values or data points from highest to lowest. For example, sorting numbers in descending order: 12, 10, 8, 6, 4, 2
What is ascending order?
Ascending order refers to arranging values from lowest to highest. For example, sorting numbers in ascending order: 2, 4, 6, 8, 10, 12
4. RANK.EQ Function Example 1
The picture above displays the arguments in C3 and C4, the list of numbers in cell range B7:B13 and the calculation in cell F2. The data is :
ref |
79 |
39 |
35 |
21 |
10 |
10 |
32 |
The arguments are:
- number = C3 (10)
- ref = B7:B13
- order = C4 (0 zero meaning descending order)
Formula in cell F2:
The image below shows the position of number 10 if the list were sorted in an descending order. Descending order refers to the arrangement of values in decreasing order from the largest to the smallest value. For example, the numbers 20, 12, 8, 5, 2 are arranged in descending order.
This list sorted in a descending order shows number 10 in position 6 which is the rank the RANK.EQ function calculates in cell F2 in the top image. Note that the last duplicate (10) also gets rank 6 and not 7.
position | ref | RANK.EQ |
1 | 79 | 1 |
2 | 39 | 2 |
3 | 35 | 3 |
4 | 32 | 4 |
5 | 21 | 5 |
6 | 10 | 6 |
7 | 10 | 6 |
The fomrula in cell F2 has relative cell references. A relative cell reference is one that changes when you copy or move the formula or cell reference to another location. For example, if you have a formula =A1+B1 in cell C1 and you copy this formula to cell C2 the formula will automatically adjust to =A2+B2.
5. RANK.EQ Function Example 2
RANK.EQ function ignores non-numeric values in ref argument. The RANK.EQ function calculates the same rank to duplicate identical numbers, however, it also moves the ranks for the following numbers. This example calculates ranks based on a list sorted in an ascending order.
ref | RANK.EQ |
10 | 1 |
10 | 1 |
21 | 3 |
32 | 4 |
35 | 5 |
39 | 6 |
79 | 7 |
The arguments are:
- number = B3
- ref = $B$3:$B$9
- order = 1 meaning ascending order
Ascending order refers to the arrangement of values in increasing order from the smallest to the largest value. For example, the numbers 2, 5, 8, 12, 20 are arranged in ascending order.
Formula in cell C3:
10 has a duplicate number, both numbers get the same rank. The following number is 21, that number gets rank 3. No number has rank 2.
The first argument is a relative cell reference, the second argument is an absolute cell reference. A relative cell reference is one that changes when you copy the formula or cell reference to another location. For example, if you have a formula =A1+B1 in cell C1, and you copy this formula to cell C2, the formula will automatically adjust to =A2+B2
An absolute cell reference is a fixed reference that does not change when you copy the formula or cell reference to another location. To create an absolute reference, you need to add dollar signs ($) before the row and column coordinates.
For example, if you have a formula =$A$1+$B$1 in cell C1, and you copy this formula to cell C2, the formula will remain =$A$1+$B$1, referring to the same cells A1 and B1, regardless of the new location.
6. RANK.EQ Function - how to return unique ranks
This example demonstrates how to distribute unique ranks using the RANK.EQ and the COUNTIF functions. If you want the to give duplicate numbers a unique rank use the following formula:
The arguments for the RANK.EQ function are:
- number = B3
- ref = $B$3:$B$9
- order = 1 meaning ascending order
The arguments for the COUNTIF function are:
- range = $B$3:B3
- criteria = B3
Formula in cell C3:
$B$3:B3 contains both a relative and an absolute cell references meaning it expands when the cell is copied to cells below. This makes the COUNTIF function evaluate the criteria argument in a larger and larger cell range. In fact, the cell range expands at the same pace as the cell formula is copied meaning the expanding cell range grows to the same row as the formula.
Explaining formula
Step 1 - Calculate rank
RANK.EQ(number,ref,[order])
RANK.EQ(B3,$B$3:$B$9,1)
1 -Numbers are ranked in an ascending order.
Step 2 - Calculate count
The COUNTIF function calculates the number of cells that is equal to a condition.
Function syntax: COUNTIF(range, criteria)
COUNTIF($B$3:B3,B3)
returns 1
Step 3 - Add count to rank
RANK.EQ(B3,$B$3:$B$9,1)+COUNTIF($B$3:B3,B3)
becomes
1+1 equals 2
Step 4 - Subtract 1
2-1 equals 1
1 is returned to cell C3.
Functions in 'Statistical' category
The RANK.EQ function function is one of 73 functions in the 'Statistical' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form