Rank per Group in Excel

You have two groups of 20 students each. How do you determine the rank of all students within their respective groups? We can use the COUNTIFS function to calculate the rank per group in Excel.

Rank per Group Using a Regular Formula

=COUNTIFS(group_range, current_group, score_range, ">" & current_score) + 1

Rank per Group Using a Dynamic Array Formula

=COUNTIFS(group_range, group_range, score_range, ">" & score_range) + 1

Overall Ranking

The sample data consists of names in column A, groups in column B, and scores in column C. To find the overall rank, enter the following formula in cell D2:

=RANK(C2, $C$2:$C$21)

and drag the fill handle (the blue square at the bottom of the active cell) down.

If you are using an Excel version that supports dynamic arrays, you can enter the following formula in cell D2, which will automatically expand down:

=RANK(C2:C21, C2:C21)
Example of overall ranking in Excel

Examples of Group-wise Ranking in Excel

To determine the rank of students within their respective groups, known as group-wise ranking, you can use either the drag-down formula or a dynamic array formula.

Since the RANK function does not support conditional ranking in Excel, we use COUNTIFS as follows:

=COUNTIFS($B$2:$B$21, B2, $C$2:$C$21, ">"&C2) + 1

Enter this formula in cell E2 and drag the fill handle down.

Alternatively, if your version of Excel supports dynamic arrays, you can use this formula:

=COUNTIFS(B2:B21, B2:B21, C2:C21, ">"&C2:C21) + 1
Example of rank per group in Excel

How Does COUNTIFS Return Rank per Group in Excel?

The COUNTIFS function is a conditional count function that accepts multiple conditions.

The formula:

=COUNTIFS($B$2:$B$21, B2, $C$2:$C$21, ">"&C2)

counts how many values within the same group (column B) have a higher score (column C) than the current row’s score.

  • If the result is 0, adding +1 ensures the student receives the top rank.
  • If the result is 1, adding +1 ensures the student receives the second rank, and so on.

When dragged down, this formula applies group-wise ranking to all scores in the range.

The dynamic array formula works the same way but without the need to drag it down manually.

That’s all about rank per group in Excel!

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Filter Top N per Category in Excel (Using FILTER & COUNTIFS)

You can use a combination of FILTER and COUNTIFS to filter the top N...

Real-Time Excel Filtering Using Combo Box & FILTER Function

In this tutorial, you’ll learn how to set up real-time Excel filtering using a...

Google Sheets: Extract Top N per Group from Query Aggregation

When working with grouped and aggregated data in Google Sheets, you might need to...

How to Extract Top N from Aggregated Query Results in Google Sheets

To summarize data in Google Sheets, you can use the QUERY function. However, if...

More like this

Filter Top N per Category in Excel (Using FILTER & COUNTIFS)

You can use a combination of FILTER and COUNTIFS to filter the top N...

Real-Time Excel Filtering Using Combo Box & FILTER Function

In this tutorial, you’ll learn how to set up real-time Excel filtering using a...

Sort Names by Last Name in Excel Without Helper Columns

Sorting by last name in Excel is useful in various real-world scenarios, especially when...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.