# How to rank duplicates without breaking sequence in Excel

Suppose you have a dataset that includes students' names and their corresponding mathematics scores. It is possible that some students have got the same score, resulting in a tie. The goal is to rank the students based on their scores without breaking sequence in the dataset. In short, we need to assign the same rank to the students with the same score.

In the example shown below, highlighted ones are the students with their same scores.

For descending rank : In cell D3, type the following formula.
`=SUMPRODUCT((\$C\$3:\$C\$10>\$C3)/COUNTIF(\$C\$3:\$C\$10,\$C\$3:\$C\$10))+1`

In descending rank, the student with the highest score is assigned the rank of 1, the second-highest score is assigned the rank of 2, and so on.

For ascending rank : In cell E3, type the following formula.
`=SUMPRODUCT((\$C\$3:\$C\$10<\$C3)/COUNTIF(\$C\$3:\$C\$10,\$C\$3:\$C\$10))+1`

In ascending rank, the student with the lowest score is assigned the rank of 1, the second-lowest score is assigned the rank of 2, and so on.

The above formula calculates the rank of the value in cell C3 compared to the other unique values in the range \$C\$3:\$C\$10. The rank is determined by counting the number of values greater than (or less than) the value in cell C3, divided by the count of each unique value. The sum of these fractions, plus 1, gives us the rank. The students with the same score have been assigned same rank.

1. The formula uses the SUMPRODUCT function, which multiplies arrays and returns the sum of the products.
2. The first part of the formula, (\$C\$3:\$C\$10>\$C3), compares each value in the range \$C\$3:\$C\$10 to the value in cell C3. It returns an array of TRUE/FALSE values, where TRUE represents values greater than (or less than) the value in cell C3.
3. The second part of the formula, COUNTIF(\$C\$3:\$C\$10,\$C\$3:\$C\$10), calculates the count of each unique value in the range \$C\$3:\$C\$10. It returns an array of counts for each unique value in the range.
4. Dividing the array from step 2 by the array from step 1 gives us a fractional array. Each element in this array represents the fraction of values greater than the value in cell C3 compared to the total count of each unique value in the range.
5. By summing up the fractional array using the SUMPRODUCT function, we get the sum of all the fractions.
6. Finally, adding 1 to the sum gives us the rank of the value in cell C3 within the range \$C\$3:\$C\$10.

Related Article : Rank duplicates and assign different ranks
Related Posts