Instead of =A2 etc, use this, copied down...
=INDEX($A$2:$A$8,MATCH(D2,$B$2:$B$8,0))

and instead of copy/paste values to get the data to sort, try his, copied down...
=SMALL($B$2:$B$8,ROWS($A$1:A1))

edit: must be an echo in here. popip used LARGE() to sort big to small, I used SMALL to sort small to big - take your pick