Is it possible to sort and remove duplicate like this in excel?

You could try:

enter image description here

Formula in D1:

=UNIQUE(CHOOSE({1,2},XLOOKUP(B1:B6,B1:B6,A1:A6,,0),B1:B6))