Hi.
I used there helper column in data table. After that use paste this array formula to b14 cell:
=IFERROR(INDEX($B$3:$G$10,LARGE(IF(($A$3:$A$10=$A21)*($H$3:$H$10=COUNTIF($B$20:B$20,B$20)),ROW($A$3:$A$10)-2,""),1),MATCH(B$20,$B$2:$G$2,0)),"") CSE
Uploading file.here. Didnt touch your outcime table. Created my own below it
Bookmarks