Hoping that i understand your goal, pls give a try to this.
In B20 and copy down, try this ARRAY formula.
=IFERROR(INDEX($A$7:$A$16,SMALL(IF(B$7:B$16<>"",ROW($A$7:$A$16)-6),ROW(A1))),"")
In C20 and copy down this one.
=IFERROR(INDEX($B$7:$F$16,MATCH(B20,$A$7:$A$16,0),MATCH(B$19,$B$6:$F$6,0)),"")
Bookmarks