Conditional rank on three criteria

eiti88

New Member
Joined
Sep 8, 2016
Messages
1
Hello,

I am having some trouble with the following table. I want to rank each type (there are 5) and speed by price (with cheapest being 1).
I.e. I want to know the rank of a Type 3 with speed 2, with the cheapest being ranked 1.

Any help much appreciated!


Type Cost Speed Braket Rank
Type 3 42.01 € 2
Type 3 48.01 € 2
Type 3 58.01 € 3
Type 3 68.01 € 3
Type 3 88.01 € 4
Type 1 24.95 € 4
Type 5 77.03 € 4
Type 4 117.03 € 4
Type 5 47.35 € 4
Type 1 37.50 € 2
Type 1 47.00 € 3
Type 1 52.00 € 4
Type 1 27.61 € 2
Type 1 47.61 € 4
Type 1 52.61 € 4
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try this...
=COUNTIFS(A:A=A2,C:C,C2,B:B,"<="&B2)

Or this...
=SUMPRODUCT(($A$2:$A$16=A2)*($C$2:$C$16=C2)*($B$2:$B$16<=B2))
 
Last edited:
Upvote 0
I think you can use COUNTIFS:


Book1
ABCD
1TypeCostSpeed BraketRank
2Type 342.01 €21
3Type 348.01 €22
4Type 358.01 €31
5Type 368.01 €32
6Type 388.01 €41
7Type 124.95 €41
8Type 577.03 €42
9Type 4117.03 €41
10Type 547.35 €41
11Type 137.50 €22
12Type 147.00 €31
13Type 152.00 €43
14Type 127.61 €21
15Type 147.61 €42
16Type 152.61 €44
Sheet1
Cell Formulas
RangeFormula
D2=1+COUNTIFS($A$2:$A$16,$A2,$C$2:$C$16,$C2,$B$2:$B$16,"<"&$B2)


WBD
 
Upvote 0
Quick note that although these two solutions are based on the same logic and provide the same values on the example data, if there are any ties on cost then they will not. See below:


Book1
ABCDEF
1TypeCostSpeed BraketCOUNTIFS RankSUMPRODUCT RANKSUMPRODUCT RANK 2
2Type 124.95 €4111
3Type 152.00 €4232
4Type 152.00 €4232
5Type 152.61 €4444
Sheet1
Cell Formulas
RangeFormula
D2=1+COUNTIFS($A$2:$A$5,$A2,$C$2:$C$5,$C2,$B$2:$B$5,"<"&$B2)
E2=SUMPRODUCT(($A$2:$A$5=A2)*($C$2:$C$5=C2)*($B$2:$B$5<=B2))
F2=SUMPRODUCT(($A$2:$A$5=$A2)*($C$2:$C$5=$C2)*($B$2:$B$5<$B2))+1


WBD
 
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,204
Members
449,072
Latest member
DW Draft

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