Rank with criteria

ORoxo

Board Regular
Joined
Oct 30, 2016
Messages
149
Hey, guys,
I'm really going crazy with this as I have not been able to figure it out for a couple of days.
Let's take the following picture as an example:

drop-down-formula-to-data-table-to-create-rank-if-with-sumproduct-for-conditional-ranking-min.png


I'm basically looking for a formula on input on column D which does the exact same thing but with one exception. Let's say we on row 21 we have data exactly as we do on row 19. In that case, I want the formula to return the "2" as it did on row 19.

Any idea how this can be achieved?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
In D2 control+shift+enter, not just enter, and copy down:

=IF(A2<>A1,IF(COUNTIFS($B$2:B2,B2,$C$2:C2,C2)=1,MATCH(B2,LARGE(IF(FREQUENCY(IF($C$2:$C$32=C2,MATCH($A$2:$A$32,$A$2:$A$32,0)),ROW($A$2:$A$32)-ROW($A$2)+1),B$2:$B$32),ROW(INDIRECT("1:"&SUM(IF(FREQUENCY(IF($C$2:$C$32=C2,MATCH($A$2:$A$32,$A$2:$A$32,0)),ROW($A$2:$A$32)-ROW($A$2)+1),1))))),0),LOOKUP(BigNum,1/(($B$1:B1=$B2)*($C$1:C1=C2)),$D$1:D1)+1),INDEX($D$1:D1,MATCH(A2,IF($C$1:C1=C1,$A$1:A1),0)))

I think the desired ranks you posted for P&R are not correct. Please t
ry to evaluate the proposal meticulously (i.e. avoid a hasty reaction).
 
Upvote 0
We are soooo soooo close...

The only problem with this is if there are two distinct students in the same department with the same grade. Assuming there are two students with the same top grade, in that case, the formula should rank one of them as 1 and the other one as 2. However, its currently ranking both as 1.

Note to self: I reallt need to study FREQUENCY function


This is how I got around this particular problem, assuming you still need help:

=SUMPRODUCT(($A$4:$A$5069=A4)*($O$4:$O$5069+ROW($O$4:$O$5069)/10000>=O4+ROW(O4)/10000))

A:A is name (you can have student name here) O:O is the score.

Replace the column index numbers and it should work. It doesn't produce a similar rank, even if you had a list of 50 scores of 25.6, it would give them a distinct rank from 1-50 with no duplicates.

This will mean that some students with an equal rank are placed below the other, but such is life.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top