Rank IF

richphi37

New Member
Joined
Jul 14, 2020
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I know there is no RankIF function, and I wish there was. I am trying to rank test grades by number if they have not failed a test previously, then by those who have failed a test in the class.
For example. If a student has a 98 average but failed a test, he would rank below a student with a 97 who has not failed any test. This must be done for the whole list. Rank the Green boxes then the red ones behind it. I tried looking at some COUNTIFS factors but could not make it work for me. If you can help I would GREATLY appreciate it.
The workbook I am working off of will only let me target the color of the failed previously, not the "Y" or the "N". I included the colors on the boxes in my example sheet picture.
Thanks.
 

Attachments

  • Sample sheet picture.PNG
    Sample sheet picture.PNG
    12.6 KB · Views: 9

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
my suggestion: when doing your averages subtract a very small amount to the score if they have failed a prior test. Row() / 100000 is a very small number unless you have a lot of students. averagescore + IF(Failed Prior = FALSE,0,Row(cellref)/1000000)

ignore, i'll wait until you answer the next question.
 
Upvote 0
I know there is no RankIF function, and I wish there was. I am trying to rank test grades by number if they have not failed a test previously, then by those who have failed a test in the class.
For example. If a student has a 98 average but failed a test, he would rank below a student with a 97 who has not failed any test. This must be done for the whole list. Rank the Green boxes then the red ones behind it. I tried looking at some COUNTIFS factors but could not make it work for me. If you can help I would GREATLY appreciate it.
The workbook I am working off of will only let me target the color of the failed previously, not the "Y" or the "N". I included the colors on the boxes in my example sheet picture.
Thanks.
so, do you want all non fails ranked higher than the fails? IE the 88 is ranked higher than the 95?
 
Upvote 0
so, do you want all non fails ranked higher than the fails? IE the 88 is ranked higher than the 95?
Right I want the non-fails ranked best to worst, then the fails ranked behind them best to worst.
Thanks
 
Upvote 0
okay, try this:

mr excel questions 22.xlsm
ABCD
1Overall GradeFailed PreviouslyPct.Rank
295.18%Y95.18%1
390.30%Y95.12%2
495.12%Y93.79%3
592.37%N91.80%4
695.63%N90.30%5
792.66%N95.63%6
893.79%Y92.70%7
990.68%N92.66%8
1088.15%N92.37%9
1191.80%Y90.68%10
1285.92%N88.15%11
1392.70%N85.92%12
richphi37
Cell Formulas
RangeFormula
C1:D13C1=LET(ys,FILTER(A2:A13,B2:B13="Y",""),ns,FILTER(A2:A13,B2:B13="N",""),nbrYs,COUNTA(ys),nbrNs,COUNTA(ns),lrgYs,LARGE(ys,SEQUENCE(nbrYs)),lrgNs,LARGE(ns,SEQUENCE(nbrNs)),nbrtotal,COUNTA(A2:A13),VSTACK({"Pct.","Rank"},HSTACK(VSTACK(lrgYs,lrgNs),SEQUENCE(nbrtotal))))
Dynamic array formulas.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

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