If one has the dynamic formula in Office 365 then we can use SORT:
=SORT(CHOOSE({1,2},TRANSPOSE(B1:D1),TRANSPOSE(INDEX(B2:D4,MATCH(H1,A2:A4,0),0))),2,-1)
And Excel will spill the results correctly.
For older we need two formula:
First get the values in order:
=LARGE(INDEX($B$2:$D$4,MATCH($H$1,$A$2:$A$4,0),0),ROW(ZZ1))
Put that in H2 and copy down.
Then we need to reference those value to get the correct name:
=INDEX($B$1:$D$1,AGGREGATE(15,7,(COLUMN(INDEX($B$2:$D$4,MATCH($H$1,$A$2:$A$4,0),0))-MIN(COLUMN(INDEX($B$2:$D$4,MATCH($H$1,$A$2:$A$4,0),0)))+1)/(INDEX($B$2:$D$4,MATCH($H$1,$A$2:$A$4,0),0)=H2),COUNTIF($H$2:H2,H2)))
Put that in G2 and copy down.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…