Here is another slightly easier to follow alternative (No offense, ChemistB!), again entered into the entire column at the same time then copied across:
=IFERROR(INDEX($A$3:$A$30,IFERROR(SMALL(IFERROR(--CONCATENATE(IFERROR(1/--(E2=$B$3:$B$30)*ROW(1:30),""),IFERROR(1/--(E2=$C$3:$C$30)*ROW(1:30),"")),""),ROW(1:30)),"")),"")
Formula edited, i had the references off slightly.
Bookmarks