I think this is what you meant:
- Current item is THIS
- Select for all items whose A = this.A and whose B = this.B
- Check the rank of THIS in the list of all matched items.
The appropriate code, in your case is:
=match(F2, sort(filter(F$2:F,C$2:C=C2,I$2:I=I2)))
Let's break it down:
filter(F$2:F,C$2:C=C2,I$2:I=I2)
gives you a list of all column F values whose corresponding C & I value matches C2 and I2, respectively.
sort(...)
sort the list in ascending order (lowest number first)
match(F2, sort(...))
gives you the rank of F2 in the matched F value list
To set the color automatically
- select F2:F100
- select "Format" >> "Conditional Formatting..."
- in "format cell if", choose "custom formula is"
- in the formula field, put
=match(F2, sort(filter(F$2:F,C$2:C=C2,I$2:I=I2)))=1
- set the format style for the lowest ranked item
Repeat the steps, but change the last number of the formula to 2, 3, 4... and set the appropriate format style
Note the formula assumes that there will never be identical F values
If you want to rank by descending order (greatest number first), you need to change formula to the following:
=match(F2, sort(filter(F$2:F,C$2:C=C2,I$2:I=I2),1,FALSE),-1)
note:
sort(...)
is now sort(..,1,FALSE)
, and match(...)
is now match(...,-1)
See match, sort, and filter
This is close to what I was wanting so I made a Sheet that will hopefully show you what I mean, since i'm very bad at explaining xD,
Link