In H4:
=IFERROR(INDEX(A$2:A$7,SMALL(IF(($B$2:$B$7=$I$1)+($D$2:$D$7=$I$1),ROW($B$2:$B$7)-ROW($B$2)+1),ROWS(A$2:$B2))),"")

"+" means "OR" this case, as you need Let say New York in column B or D.