
Originally Posted by
daffodil11
I wrote a function that can do it.
I think that there could be many ways to interpret what is the correct result of this one, your function doesn't always give the results that I would expect, where as I expect that this array formula doesn't give the results you would expect.
Formula:
=IFERROR(INDEX(($F2,$I2,$L2,$O2,$R2),1,1,MATCH(LARGE(IFERROR((1/(1/FREQUENCY(CHOOSE(ROW($A$1:$A$5),$F2,$I2,$L2,$O2,$R2),CHOOSE(ROW($A$1:$A$5),$F2,$I2,$L2,$O2,$R2))))-(ROW($A$1:$A$6)/100),""),COLUMNS($S2:S2)),FREQUENCY(CHOOSE(ROW($A$1:$A$5),$F2,$I2,$L2,$O2,$R2),CHOOSE(ROW($A$1:$A$5),$F2,$I2,$L2,$O2,$R2))-(ROW($A$1:$A$6)/100),0)),"")
Compare the results of your code to the formula for rows 8 and 9 of the sample file, and also an array of 1,1,2,3,3 or similar, where 2 values appear twice in the array.
I think that it might be best to wait for the OP to clarify before making too many changes.
Bookmarks