I am looking how to pick a winner, a 2nd and 3rd place out of a list of scores (player names in row 1 and scores in row 2). The difficulty is how to take into account when there are ties. The rules I would like to follow are the following:
Sofar I have the following:
The winner:
=INDEX($A$1:$G$1;MATCH(LARGE($A2:$G2;1);$A2:$G2;0))
2nd place:
=IF(COUNTIF(A2:G2;">"&0)=1;"-";INDEX($A$1:$G$1;MATCH(LARGE($A2:$G2;2);$A2:$G2;0)))
Example: Player 1 (250), Player 2 (300), Player 3 (300) => Winner Player 2, 2nd place Player 3
Thanks a lot,
Following is the formula for finding second place in case two players has same highest score -
=IF(COUNTIF(A2:H2,">"&0)=1,"-",IF(LARGE($A2:$G2,1)=LARGE($A2:$G2,2),INDEX($A$1:$G$1,MATCH(LARGE($A2:$G2,2),OFFSET(A2,0,MATCH(LARGE($A2:$G2,1),$A2:$G2,0),1,6),0)+MATCH(LARGE($A2:$G2,1),$A2:$G2,0)),INDEX($A$1:$G$1,MATCH(LARGE($A2:$G2,2),A2:G2,0))))
Basically, I have added one if formula around your given formula -
1) If two players has same highest score -
LARGE($A2:$G2,1)=LARGE($A2:$G2,2)
change the range of match formula lookup array. This dynamic range is specified using offset -
INDEX($A$1:$G$1;MATCH(LARGE($A2:$G2;2);OFFSET(A2;0;MATCH(LARGE($A2:$G2;1);$A2:$G2;0);1;6);0)+MATCH(LARGE($A2:$G2;1);$A2:$G2;0))
2) If winner and second place player does not have same score, original formula is used.
INDEX($A$1:$G$1;MATCH(LARGE($A2:$G2;2);A2:G2;0))
Limitation of this approach is that it would not be possible to make this formula generic.
For example, for finding third place, there are 4 possible scenarios -