Try this one
in A6 and pull formula across and then down
=IFERROR(INDEX(J:J,SMALL(IF($I$2:$I$39=$B$2,ROW($I$2:$I$39)),ROWS(I$2:I2))),"")
...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
Bookmarks