Rank Numeric Values with Duplicate in Google Sheets

Suppose you have an urgent task of ranking a list with duplicate values, what would be the first approach you would think of? Is there a quick and easy way to do this task in Google Sheets? This article will talk about how to rank a given list that contains duplicate values by using the RANK formula in google Sheets.

The Rank function is a built-in function of google sheets that can be used to rank the values in a set; in other words, if the given list includes duplicate values, then the rank number will also be duplicate. See the following example.

Rank Numeric Values with Duplicate in Google Sheets1

From the above screenshot, you can see that the cell range A2:A9 includes 2 of the same number 100, which is ranked as 3 in the whole list, and there is no value ranked as 4 in the sorting column, because the value ranked 4 has been occupied by 3.

If we want to avoid this problem (4 should be assigned to the second 100), when we encounter a duplicate number in a set of numbers, instead of assigning it the previously used rank number, we will assign it a new rank number that follows exactly the previous rank number.

If you want to avoid the above problem of the ranked values being occupied, then you can use the following formula based on the Google Sheets RANK and COUNTIF functions:

=RANK(A2,$A$2:$A$9)+COUNTIF($A$2:A2,A2)-1

Rank Numeric Values with Duplicate in Google Sheets1

Then you need to press the shortcut to allow other cells in the sorted column to apply the formula as well. CTRL+Enter

Let’s See How This Formula Works:

As mentioned above, if you just use the Google Sheets Rank function to sort a given list of values, and as soon as it contains duplicate values, then the duplicate ranking values will be displayed in the sort results column.

When sorting a list of values, the following 2 key points need to be cleared:

  • Whether the sorted result is in ascending or descending order
  • Whether the sorted result can contain duplicate numbers or must be unique

RANK EXPLANATION

You can simply think that the RANK function in google sheets is used to rank a given list of values in ascending or descending order.

Syntax:

=RANK(number, reference, [order])
  • number – Need to determine the number of rankings
  • reference– a set of numbers for ranking
  • order – optional; ascending (1) or descending order (0)

You can specify whether the RANK function sorts in ascending or descending order as you need. For example, for a running race , you can use ascending order to sort, and for sales result , you can use descending order to sort. For the RANK function, the default sorting option is ascending.

COUNTIF EXPLANATION

The COUNTIF function in google sheets is used to count the number of cells that meet a given criteria.

 Syntax:

=COUNTIF(range, criteria)

 FORMULA EXPLANATION

=RANK(A2,$A$2:$A$9)

In this example, the numbers are arranged in a fixed range. To avoid the range being adjusted when copying the formula, so we add $ to lock the range. This formula works well if there are no duplicate numbers, and the RANK function will assign 1 to the largest number and 2 to the second largest number according to the rule, and so on.

Unfortunately, the given list of values have duplicate values, in order to avoid duplicate ranking values, you must use the RANK function and COUNTIF function to build a new google sheets formula together.

Rank Numeric Values with Duplicate in Google Sheets1

=COUNTIF($A$2:A2,A2)

When copying the formula downward, the given range $A$2:A2 is extended, the starting cell A2 is locked, and the ending cell is the cell where the RANK function is currently working. Therefore, If the COUNTIF function encounters a duplicate value when counting, it will return the number of times that value has been repeated.

  • If number only appears once, COUNTIFreturns 1 as current row is included in selected range;
  • If number appears twice, COUNTIF returns 2, and so on;

Rank Numeric Values with Duplicate in Google Sheets1

=COUNTIF($A$2:A2,A2)-1

Since the number appears at least once in the selected range, for example, COUNTIF($A$2:A2,A2) returns 1, we use the subtraction operation “-1” to offset the value returned by COUNTIF.

Rank Numeric Values with Duplicate in Google Sheets1

Related Functions


  • Google Sheets RANK Function
    The Google Sheets Rank function is used to return the ranking of a given number from a list. If there are duplicate numbers in the list, then the numbers will be in the same rank.The syntax of the Google Sheets Rank function is explained as follows:The syntax of the Google Sheets Rank function is explained as follows:= RANK (number,reference ,[order])…
  • Google Sheets COUNTIF function
    The google sheets COUNTIF function is used to count the number of cells in a cell range that meet a given condition.The syntax of the Google Sheets COUNTIF function is explained as follows: = COUNTIF (range, criteria)…

Related Posts

Rank Data with Multiple Criteria in google sheets

If you are an enthusiastic Google Sheets user, then you may have an urgent task to rank a specified datelist based on given multiple criteria; you can easily perform this task manually, which is also feasible, but it only works ...

Sort Dynamic Data in google sheets

 This article will talk about how to sort the dynamic data in google sheets automatically. How to use RANK formula to sort the data of a given dynamic range in google sheets. Sort Dynamic Data suppose you have a list ...

Reverse Rank Order in google sheets

This article will talk about how to rank the given data in reverse order in google sheets. You can use Google sheets RANK function to rank the data. By default, the largest value in the data table will be ranked ...

Rank Numbers without Repetitive Ranks in google sheets

This article will guide you how to rank numbers in a range with unique ranking in google sheets. How to use the Rank function in google sheets to get a unique ranking for ranges with duplicate values. Ranking without Repetitive ...

Google Sheets Rank Function

This article will introduce you how to use the RANK function in google sheets, and will show you a good example to better understand the usage of the RANK function. Google Sheets Rank Function Description The Google Sheets Rank function ...

Calculate Compound Interest using FV Function in Google Sheets

This article will show you how to calculate compound interest in Google Sheets. It will help you calculate the interest you will accrue on a given amount of money. There are several ways to calculate compound interest Google Sheets. One ...

Count Attendance and Absence with Google Sheets COUNTIF

In our campus life and work life, we usually record everyone's attendance. Today we will introduce you the application of Google Sheets COUNTIF function to count the attendance. Using a week as an example, we use the following example to ...

Find the Closest Data to the Data Provided in Google Sheets

In our daily work, we may encounter such an issue that to find the closest value to a certain value. In fact, google sheets internal functions can help us solve this problem. In today’s article, we will show you how ...

Basic Array Formula With Examples in Google Sheets

Are you searching for an article for getting the basic array formula with different examples for better understanding? Then congratulations because you have just landed on the right article. In this article, you would get to know the basic array ...

Average Of Numbers With Multiple Criteria in Google Sheets

Have you ever come across a task to calculate the average of the numbers with respect to multiple criteria in google sheets? Are you tired of doing this cumbersome task manually? Are you willing to do this task smartly in ...

Sidebar