Rank with Multi Conditions

Hello Experts,
I want to get formula that able to return custom ranking in the column Rank, with following conditions:
1- If Score2 is highest in the class and there is no duplicate value then it will be ranked as 1.
2- If Score2 is highest in the class and there is duplicate value then the record with highest Score1 should be ranked as 1.

See the picture for more understanding. Data Capture
LVL 7
abbas abdullaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ShumsDistinguished Expert - 2017Commented:
Hi,

You can use below Array Formula in E2:
=IF(AND(MAX(IF($A$2:$A$7=$A2,$C$2:$C$7))=$C2,MAX(IF($A$2:$A$7=$A2,$D$2:$D$7))=$D2),1,2)

Open in new window

Confirm with Ctrl+Shift+Enter
RankingHope this helps.
Rank-With-Multiple-Condition.xlsx
0
abbas abdullaAuthor Commented:
Good solution Shums- Two issues here:
1- Change Person 3 Score1 to 97% and Score2 to 100% Then he should be ranked as 1,but the formula returns 2
2- Forget to mention formula should continue rank 1,2,3,4... if there is more values in the data-set.
0
ShumsDistinguished Expert - 2017Commented:
It would be helpful, if you can provide sample data with expected result.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

abbas abdullaAuthor Commented:
Dear Shums,

To make it easier I expect the function to return the sequence of the data if I  did Custom sort with following levels:
  1. Level 1: Class , A to Z
  2. Level 2:Score2, Largest to Smallest
  3. Level 3: Score1, Largest to Smallest

See the attached file
Rank-With-Multiple-Condition-Custom.xlsx
0
ShumsDistinguished Expert - 2017Commented:
Hi Abbas,

The simplest would be to add Helper Column adding both scores and ranking them with below formula:
=COUNTIFS([Class],[@Class],[Final Score],">"&[@[Final Score]])+1

Open in new window

RankingRank-With-Multiple-Condition_v1.xlsx
0
abbas abdullaAuthor Commented:
Hi Shums,

I appreciate your patience for solving my question. there will be situations in the data set where Score2 is the greatest so no consideration should happen for score 1. for example in class A

1st set
Score 2 = 95%, Score 1= 95% - sum= 190
2nd set
Score 2= 96% , Score1 = 80% - sum= 176
3rd set
Score 2=95% , Score 1= 88% - sum=183

in this scenario the rank should be this way:
1 for 2nd because it has greatest score 2
2 for 1st because it has has highest score 1
3 for 3rd because it has less score 1

I hope the idea is clear.
0
Rgonzo1971Commented:
Hi,

pls try by multiplying Score2 by 1000 in Final Score

Regards
Rank-With-Multiple-Condition_v2.xlsx
0
ShumsDistinguished Expert - 2017Commented:
Hi,

Check if this helps:

=IF([@Score2]>=[@Score1],COUNTIFS([Class],[@Class],[Score2],">"&[@Score2])+1,COUNTIFS([Class],[@Class],[Score1],">"&[@Score1])+1)

As per your above example:
3 for 3rd because it has less score 1, but in your Data Set Score 2=95% , Score 1= 88% - sum=183, Score1 is not the lowest amongst 3 set, If I change Score2 = 94 then it shows your expected result as per example;
RankingRank-With-Multiple-Condition_v3.xlsx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
abbas abdullaAuthor Commented:
Thank you very much for the help. both solutions are awesome.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.