Assuming out put for names are in Column E...
For Excel 2013.
=IFERROR(INDEX($B$2:$B$8,MATCH(0,IF(ISBLANK($B$2:$B$8),1,COUNTIF(E1:$E$1,$B$2:$B$8)),0)),"")
Enter as array (CSE). And drag down as far as you need to.
For Excel 2003 or older, change =IFERROR(Calc,"") to =IF(ISERROR(Calc),"",Calc)