One of those things that excel will not do very well.
Copy your original list and paste to E6
In E35, enter the following array formula, and copy down until it returns a blank row.
=IFERROR(INDEX($B$6:$B$34,SMALL(IF(ISERROR(MATCH($B$6:$B$34,$A$6:$A$34,0)),ROW($B$6:$B$34)-ROW($B$6)+1),ROWS($E$35:$E35))),"")
In F35, enter the following array formula, and copy down until it returns a blank row.
=IFERROR(INDEX($A$6:$A$34,SMALL(IF(ISERROR(MATCH($A$6:$A$34,$B$6:$B$34,0)),ROW($A$6:$A$34)-ROW($A$6)+1),ROWS($F$35:$F35))),"")
Note that array formulas must be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
Next, select the cell with the last formula in column E that returns a name, (not blank), then press Shift, Ctrl and up arrow, then click the 'Sort' A-Z button on the 'Data' tab. Repeat this with Column F.
Note that the sorting needs to be done per column as above to work correctly (if you check your sample, column A is not sorted, when you sorted column B, column A was re-sorted with it, A25, A31 and A33 are incorrectly sorted).
Once sorted, press Ctrl A to select all of the names and formulas in both columns, then press Ctrl g, and click 'Special'. Select 'Formulas' then click Ok.
Tap the delete key to remove the formulas and restore the blanks next to the unique rows.
Note that you could also enter the formulas in A35 and B35 respectively, and sort the original list in place, no need to create a second copy of the list.
Bookmarks