lecxe:
hrlngrv:...
=INDEX(D,MATCH(LARGE(IF(MATCH(D,D,0)=ROW(D)-MIN(ROW(D))+1,
COUNTIF(D,D)-(ROW(D)-MIN(ROW(D)))/ROWS(D)),ROWS(J$1:J1)),
IF(MATCH(D,D,0)=ROW(D)-MIN(ROW(D))+1,
COUNTIF(D,D)-(ROW(D)-MIN(ROW(D)))/ROWS(D)),0))
Well, if I combine our efforts in one formula, I think it can still be shortened a bit:
range reference changed to D for comparability
=INDEX(D,MATCH(LARGE(IF(FREQUENCY((MATCH(D,D,0)),ROW(D)),
COUNTIF(D,D)+ROW(D)/(1+ROW(D))),ROW(A1)),
IF(FREQUENCY((MATCH(D,D,0)),ROW(D)),
COUNTIF(D,D)+ROW(D)/(1+ROW(D))),0))
On the new subtopic of proof of correctness, you've got a problem in your FREQUENCY calls, namely, their dependence on thier second argument array starting at 1. Using A1:A10 provides this, but it makes your formula overly dependent on using such ranges. Generalizing it, fixing the positional term so it returns values in original order, and eliminating unnecessary parentheses, your formula becomes
=INDEX(D,MATCH(LARGE(IF(FREQUENCY(MATCH(D,D,0),ROW(D)-MIN(ROW(D))+1),
COUNTIF(D,D)-(ROW(D)-MIN(ROW(D)))/ROWS(D)),ROW(A1)),
IF(FREQUENCY(MATCH(D,D,0),ROW(D)-MIN(ROW(D))+1),
COUNTIF(D,D)-(ROW(D)-MIN(ROW(D)))/ROWS(D)),0))
Still longer.
Once you adapt your formula to refer to a generic range, there's no benefit to the FREQUENCY call.
In different terms, if I were to assume D began in row 1, I could rewrite my formula as
=INDEX(D,MATCH(LARGE(IF(MATCH(D,D,0)=ROW(D),
COUNTIF(D,D)-ROW(D)/ROWS(D)),ROWS(J$1:J1)),
IF(MATCH(D,D,0)=ROW(D),COUNTIF(D,D)-ROW(D)/ROWS(D)),0))
Note on the positional term: if you want to display tied items in original order, and the base ordering is descending, then either add larger subordinate terms for items that appear earlier in the data or subtract smaller subordinate terms for items that appear earlier in the data. The latter is shorter.
Note on ROW(A1) vs ROWS(J$1:J1): ROW always returns an array, even single item arrays. ROWS never returns an array. There are obscure cases in which Excel can't handle ROW calls returning single items in longer formulas, at least not without wrapping those ROW calls inside SUM or INDEX(ROW(.),1) calls to force them to scalars.
lecxe:Efficiency however, I cannot meassure. . . .
It's measurable. You
could measure it if you knew how and had the inclination to do so. FREQUENCY(a,b) clearly does more work than a=b.