In the attached, see formula at cell AI2:
Code:
=LET(rws,($D$2:$D$97=$D2)*($G$2:$G$97=$G2),TAKE(SORT(VSTACK(VALUE(TEXTSPLIT(TEXTJOIN("¬",TRUE,FILTER($N$2:$O$97,rws)),"¬")),VALUE(TEXTSPLIT(TEXTJOIN("¬",TRUE,FILTER($Z$2:$AA$97,rws)),"¬"))),2,-1,TRUE),1))
Copy down. It will spill to the right. I feel sure it could be more elegant.
Note that I used my shorter formula in msg#22 in cells AB2:AC25; it's more robust.