*The tutorial explains the specificities of the Excel Rank functions and shows how to do ranking in Excel based on multiple criteria, rank data by group, calculate percentile rank, and more.*

When you need to determine the relative position of a number in a list of numbers, the easiest way is to sort the numbers in ascending or descending order. If for some reason sorting is not possible, a Rank formula in Excel is the perfect tool to do the job.

The RANK function in Excel returns the order (or rank) of a numeric value compared to other values in the same list. In other words, it tells you which value is the highest, the second highest, etc.

In a sorted list, the rank of a certain number would be its position. The RANK function in Excel can determine the rank starting with the largest value (as if sorted in descending order) or the smallest value (as if sorted in ascending order).

The syntax of the Excel RANK function is as follows:

RANK(number,ref,[order])

Where:

**Number** (required) - the value whose rank you'd like to find.

**Ref** (required) - a list of numeric values to rank against. It can be supplied as an array of numbers or a reference to the list of numbers.

**Order **(optional) - a number that specifies how to rank values:

- If 0 or omitted, the values are ranked in descending order, i.e. from largest to smallest.
- If 1 or any other non-zero value, the values are ranked in ascending order, i.e. from smallest to largest.

RANK.EQ is an improved version of the RANK function, introduced in Excel 2010. It has the same syntax as RANK and works with the same logic: if several values are ranked equally, the top rank of that group of values is returned (EQ stands for "equal").

RANK.EQ(number,ref,[order])

In Excel 2007 and lower versions, you should always use the RANK function. In Excel 2010, Excel 2013, and Excel 2016, you can go with either RANK or RANK.EQ. However, it'd be wise to use RANK.EQ because RANK can be discontinued at any moment.

RANK.AVG is another function to find rank in Excel that is available only in Excel 2010, Excel 2013, Excel 2016 and later.

It has the same syntax as the other two functions:

RANK.AVG(number,ref,[order])

The difference is that if more than one number has the same rank, the **average rank** is returned (AVG stands for "average").

- Any Rank formula in Excel works only for numeric values: positive and negative numbers, zeros, date and time values. Non-numeric values in the
*ref*argument are ignored. - All RANK functions return the same rank for duplicate values, and skip subsequent ranking, as shown in the example below.
- In Excel 2010 and later versions, the RANK function has been replaced with RANK.EQ and RANK.AVG. For backward compatibility, RANK still works in all versions of Excel, but it may not be available in the future.
- If
*number*is not found within*ref*, any Excel Rank function would return the #N/A error.

To gain more understanding about ranking data in Excel, please have a look at this screenshot:

All three formulas rank numbers in column B in **descending order** (the *order* argument omitted):

In all versions of Excel 2003 - 2016:

`=RANK($B2,$B$2:$B$7)`

In Excel 2010 - 2016:

`=RANK.EQ($B2,$B$2:$B$7)`

`=RANK.AVG($B2,$B$2:$B$7)`

The difference is in how these formulas process duplicate values. As you see, the same score appears twice, in cells B5 and B6, which affects subsequent ranking:

- The RANK and RANK.EQ formulas give a rank of 2 to both duplicate scores. The next highest score (Daniela) is ranked 4th. A rank of 3 is not given to anyone.
- The RANK.AVG formula assigns a different rank to each duplicate behind the scenes (2 and 3 in this example), and returns the average of those ranks (2.5). Again, the 3rd rank is not assigned to anyone.

The path to excellence, they say, is paved with practice. So, to better learn how to use RANK function in Excel, alone or in combination with other functions, let's work out solutions to a few real-life tasks.

As shown in the above example, to rank numbers from highest to lowest, you use one of the Excel Rank formulas with the *order* argument set to 0 or omitted (default).

To have *number* ranked against other numbers sorted in **ascending order**, put 1 or any other non-zero value in the optional third argument.

For example, to rank the 100-meter sprint times of the students, you can use either of the below formulas:

`=RANK(B2,$B$2:$B$7,1)`

`=RANK.EQ(B2,$B$2:$B$7,1)`

Please pay attention that we lock the range in the *ref* argument by using absolute cell references, so that it won't change when we copy the formula down the column.

As the result, the lowest value (fastest time) is ranked 1st and the largest value (slowest time) gets the lowest rank of 6. The equal times (B2 and B7) are given the same rank.

As pointed out earlier, all of the Excel Rank functions return the same rank for items of equal value. If that's not want you want, use one of the following formulas to resolve tie-break situations and give a **unique rank** to each number.

To rank the math scores of our students uniquely in descending order, use this formula:

`=RANK.EQ(B2,$B$2:$B$7)+COUNTIF($B$2:B2,B2)-1`

To rank the 100-meter race results in ascending order with no duplicates, use this formula:

`=RANK.EQ(B2,$B$2:$B$7,1)+COUNTIF($B$2:B2,B2)-1`

As you may have noticed, the only difference between the two formulas is the *order* argument of the RANK.EQ function: omitted to rank values descending, 1 to rank ascending.

In both formulas, it's the COUNTIF function with the clever use of relative and absolute cell references that does the trick. In short, you use COUNTIF to find out how many occurrences of the number being ranked there are in the above cells, including the number's cell. In the topmost row where you enter the formula, the range consists of a single cell ($B$2:B2). But because you lock only the first reference ($B$2), the last relative reference (B2) changes based on the row where the formula is copied. Thus, for row 7, the range expands to $B$2:B7, and the value in B7 is compared to each of the above cells.

Consequently, for all unique values and 1st occurrences of duplicate values, COUNTIF returns 1; and you subtract 1 at the end of the formula to restore the original rank.

For 2nd occurrences of duplicate values, COUNTIF returns 2. By subtracting 1 you increment the rank by 1 point, thus preventing duplicates. If there happen to be 3 occurrences of the same value, COUNTIF()-1 would add 2 to their ranking, and so on.

Another way to rank numbers in Excel uniquely is by adding up two COUNTIF functions:

- The first function determines how many values are greater than or less than the number to be ranked, depending on whether you are ranking descending or ascending, respectively.
- The second function (with the "expanding range" $B$2:B2 as in the above example) gets the number of values equal to the number.

For example, to rank numbers uniquely from highest to lowest, you'd use this formula:

`=COUNTIF($B$2:$B$7,">"&$B2)+COUNTIF($B$2:B2,B2)`

As shown in the screenshot below, the tie-break is successfully resolved, and a unique rank is assigned to each student:

The previous example has demonstrated two working solutions for an Excel RANK tie break situation. However, it may seem unfair that equal numbers are ranked differently based solely on their position in the list. To improve your ranking, you may want to add one more criteria to be considered in case of a tie.

In our sample dataset, let's add total scores in column C and calculate rank as follows:

- First, rank with
*Math Score*(main criteria) - When there is a tie, break it with
*Total Score*(secondary criteria)

To have it done, we will be using a regular RANK/RANK.EQ formula to find rank, and the COUNTIFS function to break a tie:

`=RANK.EQ($B2,$B$2:$B$7)+COUNTIFS($B$2:$B$7,$B2,$C$2:$C$7,">"&$C2)`

Compared to the above example, this rank formula is more objective: Timothy is ranked 2^{nd} because his total score is higher than that of Julia:

The RANK part of the formula is obvious, and the COUNTIFS function does the following:

- The first
*criteria_range*/*criteria*pair ($B$2:$B$7,$B2) counts the occurrences of the value you are ranking. Please notice, we fix the*range*with absolute references, but do not lock the*criteria*'s row ($B2) so that the formula checks the value in each row individually. - The second
*criteria_range*/*criteria*pair ($C$2:$C$7,">"&$C2) finds out how many total scores are greater than the total score of the value being ranked.

Because COUNTIFS works with the AND logic, i.e. counts only cells that meet all of the specified conditions, it returns 0 for Timothy since no other student with the same Math score has a higher total score. Hence, Timothy's rank returned by RANK.EQ is unchanged. For Julia, the COUNTIFS function returns 1 because one student with the same Math score has a higher total, so her rank number is incremented by 1. If one more student had the same Math score and a total score lower than that of Timothy and Julia, his/her rank would be incremented by 2, and so on.

Instead of the RANK or RANK.EQ function, you could use COUNTIF to check the main criteria, and COUNTIFS or SUMPRODUCT to resolve a tie break:

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

`=COUNTIF($B$2:$B$7,">"&B2)+SUMPRODUCT(--($C$2:$C$7=C2),--($B$2:$B$7>B2))+1`

The result of these formulas are exactly the same as shown above.

In statistics, a *percentile* (or *centile*) is the value below which a certain percentage of values in a given dataset falls. For example, if 70% of students are equal to or below your test score, your percentile rank is 70.

To get percentile rank in Excel, use the RANK or RANK.EQ function with a non-zero *order* argument to rank numbers from smallest to largest, and then divide the rank by the count of numbers. So, the generic **Excel Percentile Rank formula** goes as follows:

RANK.EQ(*topmost_cell*,*range*,1)/COUNT(*range*)

To calculate the percentile rank of our students, the formula takes the following shape:

`=RANK.EQ(B2,$B$2:$B$7,1)/COUNT($B$2:$B$7)`

To have the results displayed correctly, be sure to set the *Percentage* format to the formula cells:

In situations when you need to rank non-contiguous cells, supply those cells directly in the *ref* argument of your Excel Rank formula in the form of a reference union, locking the references with the $ sign. For example:

`=RANK(B2,($B$2,$B$4,$B$6))`

To prevent errors in non-ranked cells, wrap RANK in the IFERROR function, like this:

`=IFERROR(RANK(B2,($B$2,$B$4,$B$6)), "")`

Please notice that a duplicate number is also given a rank, though cell B5 is not included in the formula:

If you need to rank multiple non-contiguous cells, the above formula may become too long. In this case, a more elegant solution would be defining a named range, and referencing that name in the formula:

`=IFERROR(RANK(B2,range), "")`

When working with entries organized into some kind of data structure, data may belong to various groups, and you might want to rank numbers within each group individually. The Excel RANK function cannot resolve this challenge, so we are going to use a more complex SUMPRODUCT formula:

Rank by group in **descending** order:

`=SUMPRODUCT((A2=$A$2:$A$7)*(C2<$C$2:$C$7))+1`

Rank by group in **ascending** order:

`=SUMPRODUCT((A2=$A$2:$A$7)*(C2>$C$2:$C$7))+1`

Where:

- A2:A7 are groups assigned to numbers.
- C2:C7 are numbers to be ranked.

In this example, we use the first formula to rank numbers in each group from largest to smallest:

Essentially, the formula evaluates 2 conditions:

- First, you check the group (A2=$A$2:$A$7). This part returns an array of TRUE and FALSE based on whether a range element belongs to the same group as A2.
- Second, you check the score. To rank values from largest to smallest (
**descending order**), use the condition (C2<$C$2:$C$11), which returns TRUE for the cells greater than or equal to C2, FALSE otherwise.

Since in Microsoft Excel terms, TRUE = 1 and FALSE = 0, multiplying the two arrays gives an array of 1's and 0's, where 1 is returned only for the rows in which both conditions are met.

Then, SUMPRODUCT adds up the elements of the 1's and 0's array, hence returning 0 for the largest number in each group. And you add 1 to the result to start ranking with 1.

The formula that ranks numbers within groups from smallest to largest (**ascending** **order**) works with the same logic. The difference is that SUMPRODUCT returns 0 for the smallest number in a particular group, since no number in that group meets the 2^{nd} condition (C2>$C$2:$C$7). Again, you replace zero rank with the 1st rank by adding 1 to the formula result.

Instead of SUMPRODUCT, you can use the SUM function to add up the array elements. But this would require using an array formula, completed via Ctrl + Shift + Enter. For example:

`=SUM((A2=$A$2:$A$7)*(C2<$C$2:$C$7))+1`

If your list of numbers contains both positive and negative values, the Excel RANK function will rank them all in no time. But what if you'd like to have positive and negative numbers ranked separately?

With numbers in cells A2 to A10, use one of the following formulas to get individual ranking for positive and negative values:

`=IF($A2>0,COUNTIF($A$2:$A$10,">"&A2)+1,"")`

`=IF($A2>0,COUNTIF($A$2:$A$10,">0")-COUNTIF($A$2:$A$10,">"&$A2),"")`

`=IF($A2<0,COUNTIF($A$2:$A$10,"<0")-COUNTIF($A$2:$A$10,"<"&$A2),"")`

`=IF($A2<0,COUNTIF($A$2:$A$10,"<"&$A2)+1,"")`

The results will look something similar to this:

To begin with, let's break down the formula that ranks positive numbers in **descending** order:

- In the logical test of the IF function, you check whether the number is greater than zero.
- If the number is greater than 0, the COUNTIF function returns the count of values higher than the number being ranked.
In this example, A2 contains the 2nd highest positive number, for which COUNTIF returns 1, meaning there is just one number greater than it. In order to start our ranking with 1, not 0, we add 1 to the formula result, so it returns a rank of 2 for A2.

- If the number is greater than 0, the formula returns an empty string ("").

The formula that ranks positive numbers in **ascending** order works a bit differently:

If the number is greater than 0, the first COUNTIF gets the total count of positive numbers in the data set, and the second COUNTIF finds out how many values are higher than that number. Then, you subtract the latter from the former, and get the desired rank. In this example, there are 5 positive values, 1 of which is greater than A2. So, you subtract 1 from 5, thus getting a rank of 4 for A2.

Formulas to rank negative numbers are based on a similar logic.

For example, to rank positive numbers and zeros from largest to smallest, use this formula: `=IF($A2>=0,COUNTIF($A$2:$A$10,">"&A2)+1,"")`

As you already know, a RANK formula is Excel handles all numbers: positive, negative and zeros. But in some cases, we just want to rank cells with data ignoring 0 values. On the web, you can find a few possible solutions for this task, but the Excel RANK IF formula, methinks, is the most universal one:

`=IF($B2=0,"",IF($B2>0,RANK($B2,$B$2:$B$10), RANK($B2,$B$2:$B$10)-COUNTIF($B$2:$B$10,0)))`

`=IF($B2=0,"",IF($B2>0,RANK($B2,$B$2:$B$10,1) - COUNTIF($B$2:$B$10,0), RANK($B2,$B$2:$B$10,1)))`

Where B2:B10 is the range of numbers to be ranked.

The best thing about this formula is that it works beautifully both for positive and negative numbers, leaving zero values out of ranking:

At first sight, the formula may seem a bit tricky. Upon a closer look, the logic is very simple.

Here's how the Excel RANK IF formula ranks numbers from largest to smallest ignoring zeros:

- The first IF checks whether the number is 0, and if it is, returns an empty string:
IF($B2=0,"", …)

- If the number is not zero, the second IF checks whether it's greater than 0, and if it is, a regular RANK / RANK.EQ function calculates its rank:
IF($B2>0,RANK($B2,$B$2:$B$10),…)

- If the number is less than 0, you adjust ranking by the zero count. In this example, there are 4 positive numbers and 2 zeros. So, for the largest negative number in B10, an Excel RANK formula would return 7. But we skip zeros, and therefore we need to adjust the rank by 2 points. For this, we subtract the number of zeros from the rank:
RANK($B2,$B$2:$B$10)-COUNTIF($B$2:$B$10,0))

Yep, it's that easy! The formula to ranks numbers from smallest to largest ignoring zeroes works in a similar manner, and it could be a good brain exercise to deduce its logic :)

When dealing with a list of positive and negative values, there may be a need to rank numbers by their absolute values ignoring the sign.

The task can be fulfilled with one of the bellow formulas, at the heart of which is the ABS function that returns the absolute value of a number:

`=SUMPRODUCT((ABS(A2)<=ABS(A$2:A$7)) * (A$2:A$7<>"")) - SUMPRODUCT((ABS(A2)=ABS($A$2:$A$7)) * (A$2:A$7<>""))+1`

`=SUMPRODUCT((ABS(A2)>=ABS(A$2:A$7)) * (A$2:A$7<>"")) - SUMPRODUCT((ABS(A2)=ABS($A$2:$A$7)) * (A$2:A$7<>""))+1`

As the result, negative numbers are ranked as if they were positive numbers:

If you wish to get an actual N number of the largest or smallest values rather than their ranking, use the LARGE or SMALL function, respectively.

For example, we can get the top 3 scores of our students with this formula:

`=LARGE($B$2:$B$7, $D3)`

Where B2:B7 is the list of scores and D3 is the desired rank.

Additionally, you can retrieve the students' names by using the INDEX MATCH formula (provided there are no duplicate scores in the top 3):

`=INDEX($A$2:$A$7,MATCH(E3,$B$2:$B$7,0))`

Similarly, you can use the SMALL function to pull the bottom 3 values:

`=SMALL($B$2:$B$7, $D3)`

That's how you do ranking in Excel. To better understand and probably reverse-engineer the formulas discussed in this tutorial, you are welcome to download our Sample Rank Excel workbook.

I thank you for reading and hope to see you on our blog next week!

Excel formulas
Excel functions
Vlookup in Excel
Merge data in Excel
SumIf
Excel CountIf
Excel Compare
Excel If statement
Excel Charts
Pivot Table
Updates
Excel conditional formatting
Excel formatting
Excel time
Excel duplicates
Excel date
Excel tips
Excel macro
Outlook
Google Sheets
Outlook duplicates
Outlook templates

## 32 Responses to "Excel RANK functions with formula examples"

Dears,

In RANK.EQ function why rank 2 is skipping to Rank 3 on re applying marks. Could you help me please.

Best regards,

-0.19

0.18

0.10

-0.04

-0.08

-0.04

-2.22

-0.67

-0.36

-0.05

-1.32

-1.36

-0.48

-1.15

0.65

0.04

0.38

-0.38

0.19

0.38

0.01

0.38

-0.68

-0.05

0.40

0.35

-0.41

-0.30

-0.02

-0.49

0.99

0.10

1.23

0.89

1.21

-1.44

-1.58

-1.38

0.10

1.00

-1.93

1.23

1.37

-1.45

-0.99

-2.05

-1.63

-1.79

How to rank this in excel?

Hello,

Suppose, your original data are in column A. If you place the following formula in B1, for example, you’ll get the result you need:

=RANK(-0.19,A:A)

If it doesn't help, then please send me a small sample workbook with your source data and the result you expect to get to support@ablebits.com. Please don't worry if you have confidential information there, we never disclose the data we get from our customers and delete it as soon as the problem is resolved.

Please also don't forget to include the link to this comment into your email.

I'll look into your task and try to help you better.

Dear Sir / Madam,

Please help me.

I have 4 Sub category each I'll give 25% ( how to find out Ranking).

Regards,

Santosh

72594 19297

how to rank data in another sheet

Thanks for helping me out to calculate Ranking of two pupils that had the same average and the same total but different positions.

I was able to sort it out through your formula.

Is there a simple way to automatically sort without using macros.

Thanks a lot

Great work Svetlana !!

The formulas work like a charm.

I have a hard problem solving these: I had rank it initially based on standard queuing, from there, it will subsequently re rank once the second line be queued.

sample:

100 initial rank 1

200 initial rank 2

500 initial rank 3

new input:

300

400

output of final rank:

100 final rank 1

200 final rank 2

300 final rank 3

400 final rank 4

500 final rank 5

please help me

what should be the best formula to get the final ranking???

thanks,

marycris

Great post, but it is missing another application of ranking. How do I get the rank and take ties in consideration? This is the result I want for example:

Name Score Rank

Joe 33 1

Lisa 31 2

Kevin 31 2

Paul 30 3

Fred 30 3

Denny 30 3

Sarah 30 3

Allen 30 3

Patrick 30 3

Anna 29 4

Johnny 29 4

Wendy 29 4

Etc..

What formula should I use?

Team Ablebits,

At the outset thanks for helping people like us.

Want to rank data with following validations /filters:

1. Filter on parameters - like order, sales, purchases

2. Positive and Negative

3. split the record, for common rank, example in case rank 2 is assigned to 2 records, it should be reassign 2 and 3 number respectively (essentially want unique number for each record)

many thanks in advance

regards

Harsh

Thank you for these. I haven't used them in a while and this was exactly the refresher I needed. Cheers!

I have a list that is ranked and now I have to give the ranked list a grade (E - Excellent, O - Outstanding, M - Meets Expectations, B - Below Expectations). I can only have 10% of my list be Exceptional, 15% outstanding, 65% Meeting Expectations, and 10% below expectations. I have 34 employees that make up this list. I can manually assign the grades based on this but is there a way to have excel do this for me?

This is AWESOME!! I was headed in the right direction logically, but this was the answer to MANY hours of trial and error!!!

Thank YOU!!

Please see the data below where I want to calculate Overall Rank from existing ranked criteria.

Note that to calculate overall rank, Rank 1 is the main criteria, followed by Rank 2 and 3. Please let me know if you have pre-built formula for this.

Dcode Rank 1 Rank 2 Rank 3 Overall Rank

1 50 50 8

2 50 3 7

3 49 25 6

4 47 14 27

5 45 17 47

6 37 7 2

7 33 47 20

8 31 34 17

9 30 2 23

10 25 21 13

11 23 13 34

12 16 37 32

13 14 6 9

14 12 30 16

15 10 40 28

16 9 26 36

17 8 32 19

18 5 1 1

19 4 24 4

20 3 45 37

21 1 46 18

The Rank.eq function will not allow me to lock the ref array. I can't figure out why this is happening. Do I have to hand enter each and every cell?

Hi Susan,

To lock the ref range, use absolute cell references with the $ sign, e.g. $A$2:$A$10. To toggle between the reference types, simply select the reference in the formular bar and press F4.

For more informatiop, please see Absolute and relative cell references in Excel.

1- I want to rank a Rang,

2- The highest number with Highest Rank

3- Rank only top 10, rest need to be filled with 0

Help please.

Thanks alot for your explanations.

It was very useful

Keep continue

Hello, I am trying to rank data based on a goal range.

The goal is to score between 450 and 500.

Currently anyone scoring 375 (as an example) is ranked higher than someone who met the goal falling between 450 and 500.

Is there a way to set this up?

how to calculate percentile rank for employee salary with designation and no of year experienc as Condition

Could you help me with a rank formula please? I need to rank negative numbers first descending then positive numbers ascending. The number closest to zero but negative is the highest ranked. The number farthest from zero but positive is the lowest ranked. The closest positive number from zero should be lower in rank than the farthest negative number from zero.

For anyone having a problem with ranking skipping numbers, here is some help. See cells F35 and F40! You're welcome!

https://docs.google.com/spreadsheets/d/1Y1AHRn-bRnVex-tFwbPV9bN4t46usrFAvRPsUPUn6i4/edit?usp=sharing

formula: =SUMPRODUCT((DD34<$F34:$DT34)/COUNTIF($F34:$DT34,$F34:$DT34))+1

Hi

If the data contains an error and we want to calculate the Rank ABS numbers ascending ignoring ERORR(ex. #value! or #n/a):, how can we do it?

for example:1,2,#value!,-5, 8, -10, 15,#N/A, 25

Hi all, I am trying to get a priority ranked list based on "Impact" (where highest number is higher impact) vs "Effort" (where lowest number is lowest effort), I want to basically get highest "Impact" / low "Effort" items on top of the list. For contest I have speadsheet where the "Impact" rating is in column H (H6 downwards) and "Effort" rating (1 = Low, 2 = Medium, 3 = High, 4 = Very High)is in column I (I6 downwards). I would like a rank of 1st to however many entries we have to be displayed in column EF (EF6 downwards)

Is there any way to do rank where you don't skip?

For instance

Score Rank

30 1

28 2

28 2

27 4

I would like it so that the 27 is a 3, is this possible?

I found an answer to this...

=SUMPRODUCT((G2 < G$2:G$27)/COUNTIF(G$2:G$27,G$2:G$27))+1

Is there any way to do the above based on a value in another column? Let's say column A contains a group number assignment (1,2 and 3).

Help me how to rank multiple categories. First pass and fail. Second look at mark

I have 20 golfers with all their gross scores from holes 1 through 18 and a total gross ... all that data in a row for each golfer. We pay 4 best gross scores. When there is a tie we go back to each hole starting at hole #1 and look for the lower score(s) which eliminates the other golfers for this payout. Then go to next hole and continue until there is only 1 golfer remaining who gets this payout award for the rank position ($40 for 1st, $30 for 2nd, $20 for 3rd, $10 for 4th). We encountered a situation where 4 golfers had the same GROSS score, on hole #1 2 of them had the same score and better (lower) than the other 2. The tie between these lower 2 finally broke by hole #10; this determined payouts for 1st and 2nd. Of the remaining 2 golfers to determine payout 3 and 4, the tie break came on hole # 5. We did all this manually/visually. Can we get this in xls formulas?? Thank you.

btw ... tie breaks is a common occurrence in golf so a formula solution would help many tournament organizers.

Excellent! after trying various methods, RANK.EQ($B2,$B$2:$B$7)+COUNTIFS($B$2:$B$7,$B2,$C$2:$C$7,">"&$C2) really worked for ranking with 4 columns!

Thanks

How to calculate the students merit so that the highest are on top and lowest in the decreasing order

problem of multi conditional ranking. Example. Students got 500,450,400,350,300,250 respectively,Number of their fail subjects r 0,0,1,1,2,2 respectively Their ranks should be as 1,2,3,4,5 ,6. Please help to prepare formula.