Skip to main content

Rank Function



How to Use the RANK Function

If you give the RANK function a number, and a list of numbers, it will tell you the rank of that number in the list, either in ascending or descending order.

For example, in the screen shot below, there is a list of 10 student test scores, in cells B2:B11.

To find the rank of the the first student's score in cell B2, enter this formula in cell C2:

=RANK(B2,$B$2:$B$11)

rank function 02

Then, copy the formula from cell C2 down to cell C11, and the scores will be ranked in descending order.

rank function 01

go to top

RANK Function Arguments

There are 3 arguments for the RANK function:

  • number: in the above example, the number to rank is in cell B2
  • ref: We want to compare the number to the list of numbers in cells $B$2:$B$11. Use an absolute reference ($B$2:$B11), instead of a relative reference (B2:B11)so the referenced range will stay the same when you copy the formula down to the cells below
  • order: (optional) This argument tells Excel whether to rank the list in ascending or descending order.
    • Use zero, or leave this argument empty, to find the rank in the list in descending order. In the example above, the order argument was left blank, to find the rank in descending order.
      =RANK(B2,$B$2:$B$11)
    • For ascending order, type a 1, or any other number except zero.
      If you were comparing golf scores, you could type a 1, to rank in ascending order.
      =RANK(B2,$B$2:$B$11,1)

go to top

RANK Function Order

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.

Order for RANK function

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.

  • The largest number gets a rank of 1
  • The 5th largest number gets a rank of 5.

Order for RANK function

Ascending 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.

  • The smallest number gets a rank of 1
  • The 5th smallest number gets a rank of 5.

Order for RANK function

Flexible Formula

Instead of typing the order argument number into a RANK formula, use a cell reference, to create a flexible formula.

For example, type a 1 in cell E1, and link to cell E1 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)

Order for RANK function

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.

Order for RANK function

Comments

Popular posts from this blog

Import CSV In Power BI

  Import CSV file Click on Get Data à More à File option and select Text/CSV . Navigate to the CSV file which needs to be imported FL_insurance_sample.csv . Select the file and click on Open. FL_insurance_sampleDownload In the CSV window on top we have 3 dropdowns, preview of data and data load options.  Select Load and it will load to power query editor window. In the Power query editor the CSV file is loaded as a Queries . In power query editor we can edit, clean and transform the file as required. 3 Dropdowns and Data Load File Origin – Type of file origin. By default its 1252 Wester European (Windows). It’s the file type as per OS and region and country. Delimiter – Delimiter for column separation. By default it detects the delimiter from data , If the delimiter is not from the default options then we can select custom delimiter. Data Type Detection – By default it detects data types of columns based on top 200 rows, we can select entire data or do not detect data type ...

Protect Formula Cells

The use of worksheet protection in Excel is a little strange. Using the steps below, you can quickly protect just the formula cells in your worksheet. It seems unusual, but all 16 billion cells on a worksheet start out with their Locked property set to True. You need to unlock all of the cells first: Select all cells by using the icon above and to the left of cell A1. Press  Ctrl+1  (that is the number 1) to open the Format Cells dialog. In the Format Cells dialog, go to the Protection tab. Uncheck Locked. Click OK. While all cells are still selected, select Home, Find & Select, Formulas. At this point, only the formula cells are selected. Press  Ctrl+1  again to display the Format Cells dialog. On the Protection tab, choose Locked to lock all of the formula cells. Locking cells does nothing until you protect the worksheet. On the Review tab, choose Protect Sheet. In the Protect Sheet dialog, choose if you want people to be able to select your formula cells or no...

20 Power BI Dax Measures

Power bi 20 dax measures 20 DAX (Data Analysis Expressions) measures in Power BI with examples: Total Sales: scss Copy code Total Sales = SUM (Sales[Amount]) Average Sales Price: scss Copy code Avg Sales Price = AVERAGE (Sales[Amount]) Total Units Sold: mathematica Copy code Total Units Sold = SUM ( Sales [ Quantity ] ) Total Customers: scss Copy code Total Customers = COUNTROWS (Customer) Total Products: mathematica Copy code Total Products = COUNTROWS ( Product ) Maximum Sales Amount: scss Copy code Max Sales Amount = MAX (Sales[Amount]) Minimum Sales Amount: scss Copy code Min Sales Amount = MIN (Sales[Amount]) Sales Growth Percentage: mathematica Copy code Sales Growth % = ( Total Sales - [ Total Sales Last Year ] ) / [ Total Sales Last Year ] Total Profit: scss Copy code Total Profit = SUM (Sales[Profit]) Total Orders: scss Copy code Total Orders = COUNTROWS (Orders) Total Customers with Sales: css Copy code Total Customers with Sales = COUNTROWS( FILTER ...