Try this Array Formula. Since this is an array formula so you need to confirm it with Ctrl+Shift+Enter instead of just Enter. (i.e. after placing the formula in the cell, hold down the Ctrl+Shift and then press Enter)
and then drag down until you get blank cells.![]()
=IFERROR(INDEX($B$2:$M$45,SMALL(IF($A$2:$A$45=$O$2,ROW($A$2:$A$45)-ROW($A$2)+1),ROWS(A$1:A1)),MATCH($O$4,$B$1:$M$1,0)),"")
Bookmarks