How to use the RANK.AVG function
What is the RANK.AVG function?
The RANK.AVG function returns the rank of a number in a list of numbers.
The number returned indicates its size relative to other values in the list. If more than one value share the same rank, the average rank is returned.
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, note that the RANK.AVG function does not rank numbers like the image demonstrates above.
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.AVG Function Syntax
RANK.AVG(number, ref, [order])
3. RANK.AVG Function Arguments
number | Required. The number whose rank you want to find. |
ref | Required. A list of numbers. |
[order] | Optional. A number specifying how to rank number. 0 - Excel ranks number as if ref were a list sorted in descending order. Default value. Any other number - 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.AVG Function Example 1
This example demonstrates how to calculate the rank of number 77 in this group: 66, 97, 99, 77, 9, 60, 35, 60, 61. Cell range B3:B11 contains the data.
The arguments are:
- number = 77
- ref = B3:B11
- [order] = 0 meaning descending order
Formula in cell D3:
The formula in cell D3 returns 3 meaning it is the third largest number in the group. The largest number is 99 and the second largest is 97.
This technique can quickly tell you where a number is in the range and also if it is an outlier.
5. RANK.AVG Function Example 2
The RANK.AVG function returns the average rank if two or more numbers share the same rank. The image above shows the test scores in cell range B3:B11 and the sorted scores in F3:F11 in descending order. The corresponding RANK.AVG ranks are in E3:E11 and RANK.EQ in D3:D11.
The test scores in cell range B3:B11 contain two identical numbers which are 60. They get rank 6 and 7, however the RANK.AVG calculates the average rank when two or more values are identical. The average of 6 and 7 is 6+7=13, 13/2 = 6.5
Number 60 is in both cells E8:E9, the average rank for 60 in this group is 6.5. Note that rank 6 and 7 are not displayed at all, only the average rank 6.5 in both locations.
Formula in cell E3:
The RANK.EQ function returns the same rank for identical values, for example, number 60 is ranked 6 in both locations in D8:D9.
Formula in cell D3:
This demonstration shows the differences between the RANK.AVG and RANK.EQ functions.
6. RANK.AVG Function Example 3
In a sales team, each member's performance is evaluated based on their monthly sales revenue. How can you use the RANK.AVG function to rank the sales team members based on their performance, taking into account any ties? Here is the sales data:
Name | Sales |
John | 113,200 |
Laura | 77,100 |
Emma | 91,900 |
Jeff | 79,400 |
Tina | 116,900 |
Lisa | 111,400 |
Linda | 92,500 |
Walter | 113,200 |
Anna | 96,000 |
The arguments are:
- number = C14
- ref = $C$14:$C$22
- [order] = not specified, default value is 0 (zero) meaning descending order
Cell range D14:D22 contains the rank based on the sales numbers in C14:C22. The highest rank is 1 and that number represents the highest sales number in the group, Tina has rank 1.
The second rank is shared between John and Walter, they both have a rank value of 2.5. The image above also displays a column chart that shows each persons sales numbers and the data labels above the columns tells us the rank.
Formula in cell D14:
This formula in cell D14 is copied to cells below as far as needed. The ref argument $C$14:$C$22 contains dollar signs meaning the cell reference is an absolute cell reference. It doesn't change when the cell is copied to cells below, however, C14 is a relative cell reference. It does change when the cell is copied to cells below.
7. RANK.AVG Function not working
- Non-numeric values in argument ref are ignored.
- The RANK.AVG function returns a #N/A value if a number in the first argument is not in the ref range.
The image above demonstrates the #N/A error value when the first argument number is not in the ref argument. For example, 111 201 is not in cell range C14:C22.
7.1 Troubleshooting the error value
When you encounter an error value in a cell a warning symbol appears. Press with mouse on it to see a pop-up menu that lets you get more information about the error.
- The first line describes the error.
- The second line opens a pane that explains the error in greater detail.
- The third line takes you to the "Evaluate Formula" tool, a dialog box appears allowing you to examine the formula in greater detail.
- This line lets you ignore the error value meaning the warning icon disappears, however, the error is still in the cell.
- The fifth line lets you edit the formula in the Formula bar.
- The sixth line opens the Excel settings so you can adjust the Error Checking Options.
Here are a few of the most common Excel errors you may encounter.
#NULL error - This error occurs most often if you by mistake use a space character in a formula where it shouldn't be. Excel interprets a space character as an intersection operator. If the ranges don't intersect an #NULL error is returned. The #NULL! error occurs when a formula attempts to calculate the intersection of two ranges that do not actually intersect. This can happen when the wrong range operator is used in the formula, or when the intersection operator (represented by a space character) is used between two ranges that do not overlap. To fix this error double check that the ranges referenced in the formula that use the intersection operator actually have cells in common.
#SPILL error - The #SPILL! error occurs only in version Excel 365 and is caused by a dynamic array being to large, meaning there are cells below and/or to the right that are not empty. This prevents the dynamic array formula expanding into new empty cells.
#DIV/0 error - This error happens if you try to divide a number by 0 (zero) or a value that equates to zero which is not possible mathematically.
#VALUE error - The #VALUE error occurs when a formula has a value that is of the wrong data type. Such as text where a number is expected or when dates are evaluated as text.
#REF error - The #REF error happens when a cell reference is invalid. This can happen if a cell is deleted that is referenced by a formula.
#NAME error - The #NAME error happens if you misspelled a function or a named range.
#NUM error - The #NUM error shows up when you try to use invalid numeric values in formulas, like square root of a negative number.
#N/A error - The #N/A error happens when a value is not available for a formula or found in a given cell range, for example in the VLOOKUP or MATCH functions.
#GETTING_DATA error - The #GETTING_DATA error shows while external sources are loading, this can indicate a delay in fetching the data or that the external source is unavailable right now.
7.2 The formula returns an unexpected value
To understand why a formula returns an unexpected value we need to examine the calculations steps in detail. Luckily, Excel has a tool that Here is how to troubleshoot a formula:
- Select the cell containing the formula you want to examine in detail.
- Go to tab “Formulas” on the ribbon.
- Press with left mouse button on "Evaluate Formula" button. A dialog box appears.
The formula appears in a white field inside the dialog box. Underlined expressions are calculations being processed in the next step. The italicized expression is the most recent result. The buttons at the bottom of the dialog box allows you to evaluate the formula in smaller calculations which you control. - Press with left mouse button on the "Evaluate" button located at the bottom of the dialog box to process the underlined expression.
- Repeat press with left mouse button oning the "Evaluate" button until you have seen all calculations step by step. This allows you to examine the formula in greater detail and hopefully find the culprit.
- Press "Close" button to dismiss the dialog box.
There is also another way to debug formulas using the function key F9. F9 is especially useful if you have a hunch that a specific part of the formula is the issue, this makes it faster than the "Evaluate Formula" tool since you don't need to go through all calculations to find the issue..
- Enter Edit mode: Double-press with left mouse button on the cell or press F2 to enter Edit mode for the formula.
- Select part of the formula: Highlight the specific part of the formula you want to evaluate. You can select and evaluate any part of the formula that could work as a standalone formula.
- Press F9: This will calculate and display the result of just that selected portion.
- Evaluate step-by-step: You can select and evaluate different parts of the formula to see intermediate results.
- Check for errors: This allows you to pinpoint which part of a complex formula may be causing an error.
The image above shows cell reference C14:C22 converted to hard-coded values using the F9 key.
Tips!
- View actual values: Selecting a cell reference and pressing F9 will show the actual values in those cells.
- Exit safely: Press Esc to exit Edit mode without changing the formula. Don't press Enter, as that would replace the formula part with the calculated value.
- Full recalculation: Pressing F9 outside of Edit mode will recalculate all formulas in the workbook.
Remember to be careful not to accidentally overwrite parts of your formula when using F9. Always exit with Esc rather than Enter to preserve the original formula. However, if you make a mistake overwriting the formula it is not the end of the world. You can “undo” the action by pressing keyboard shortcut keys CTRL + z or pressing the “Undo” button
Other errors
Floating-point arithmetic may give inaccurate results in Excel - Article
Floating-point errors are usually very small, often beyond the 15th decimal place, and in most cases don't affect calculations significantly.
Functions in 'Statistical' category
The RANK.AVG 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