|
Home > Formulas > Statistical > RANK Excel RANK Function Examples
|

Use the RANK worksheet function to compare numbers to other numbers in a list. I show the steps in this video, and the written steps are below the video.
There are three Microsoft Excel functions for ranking numbers:
All three functions are in the Statistics category
On this page, I use the RANK function, and you could use RANK.EQ in any of the formulas, for the same results.
See details for the newer functions on the following Microsoft support pages:
The RANK function compares individual numbers, to a list of numbers, and returns the rank of a number in the list.
For example, in the screen shot below, there is an Excel table, with 10 student names and test scores.
To calculate the rank for each student's score, from highest to lowest, enter this formula in cell C2:
or use this formula:

The formula automatically fills down, to the last row in the table.
The student scores are all ranked, from highest value (rank 1), to the lowest number (rank 10).

In the RANK function syntax, there are 2 required arguments, and 1 optional argument:
Note: The RANK.EQ and RANK.AVG functions have the same 3 arguments in their syntax.
In the RANK function, the 3rd argument (order), is optional. The order argument tells Excel whether to rank the list in ascending or descending order.

If you use a zero as the setting for order, or if you don't use the 3rd argument, the rank is set in descending order.

If you use a 1 as the setting for order, or if you enter any number except zero as the 3rd argument, the rank is set in ascending order.

There isn't a RANKIF function in Excel, but you can use the COUNTIFS function to calculate a number's rank based on specific criteria.
In the example below, the COUNTIFS formula in column D ranks each day's sales, compared to other days in the same week.

Here's the COUNTIFS sales ranking formula in cell D2:
And here's how the formula calculates its rankings:
For example, for June 11th, there are two larger numbers in week 24, so its rank is 3 (2+1)
Get the zipped sample Excel RANK Function file. The file is in xlsx format, and does not contain macros.
In this section, you'll find related Excel tips, shortcuts, skills, and details. These things are nice to know, but not essential, so you can skip this section, and get back to work. Or dive in, for some extra Excel fun and knowledge!
-- Sort Order - Worksheet Cell
Instead of typing the order argument number into a RANK formula, you can use a cell reference, to create a flexible formula.
For example, in the screenshot below, I typed a 1 in cell E1, and linked to cell E1 in the formula, for the order argument.
| ▶ |
Note: Be sure to use an absolute reference ($E$1), if the formula will be copied down to other rows. If you use a relative reference (E1), the reference will change in each row. |
=RANK(B2,$B$2:$B$6,$E$1)

By linking to a cell, you can quickly see different results, without changing the formula. Type a zero in cell E1, or delete the number, and the rank will change to Descending order.

Another way to input the sort order setting, is to use a check box on the worksheet.
.In cell C2, the RANK formula refers to cell E3, to get the sort order setting.

This example is in the RANK function sample file, on the OrderCheck worksheet. For instructions on how to add a check box, and use it in a formula, see the Use Check Box Result in Excel Formula page.
For more examples of flexible formulas, see
Don't miss my monthly Excel newsletter! You'll get quick tips, article links, and a bit of fun. Add your email, and click Sign Up.
Next, when you get my reply, click the Confirm button. I add this step to protect you from spam!
Last updated: May 20, 2025 7:42 PM