Try using the following formula:
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/w9eeE.png)
• Formula used in cell H1
=LET(
a,TOCOL(B2:F6),
b,TOCOL(IFNA(A2:A6,SEQUENCE(,ROWS(B2:F6)))),
c,TOCOL(IFNA(B1:F1,SEQUENCE(ROWS(B2:F6)))),
d,TAKE(SORT(HSTACK(a,b,c),1,-1),3),
VSTACK({"Rank","Value","RowID","ColID"},
HSTACK(SEQUENCE(ROWS(d)),d)))
This is another alternative formula but the number of bytes is more as well it uses LAMBDA( ) helper function BYROW( )
=LET(
a,A1:F6,
b,TAKE(SORT(TOCOL(DROP(a,1,1)),,-1),3),
c,BYROW(b,LAMBDA(m,CONCAT(REPT(DROP(a,1,-5)&"|"&TAKE(a,1,-5),m=DROP(a,1,1))))),
d,HSTACK(SEQUENCE(ROWS(b)),b,TEXTBEFORE(c,"|"),TEXTAFTER(c,"|"))+0,
VSTACK({"Rank","Value","RowID","ColID"},d))
Bit less bytes than the earlier one:
=LET(
a,A2:A6,
b,B1:F1,
c,B2:F6,
d,TAKE(SORT(TOCOL(c),,-1),3),
e,SEQUENCE(ROWS(d)),
HSTACK(VSTACK("Rank",e),REDUCE({"Value","RowID","ColID"},d,LAMBDA(x,y,
VSTACK(x,HSTACK(y,CONCAT(REPT(a,y=c)),CONCAT(REPT(b,y=c)))+0)))))
73
theRowID
will be5
and not3