Input E1 find "AAA or BBB"
E2,E3
=IFERROR(INDEX($B$2:$B$11, SMALL(IF(INDEX($C$2:$D$11,,MATCH($E$1,$C$1:$D$1,0))>0, ROW($B$2:$B$11)-MIN(ROW($B$2:$B$11))+1), ROW(1:1))), "")
Code from Copliot help
Keep document that easy to find
Input E1 find "AAA or BBB"
E2,E3
=IFERROR(INDEX($B$2:$B$11, SMALL(IF(INDEX($C$2:$D$11,,MATCH($E$1,$C$1:$D$1,0))>0, ROW($B$2:$B$11)-MIN(ROW($B$2:$B$11))+1), ROW(1:1))), "")
Code from Copliot help