Solution 1:

This Array Formula will solve the issue:

enter image description here

How it works:

  • Formula in Cell G88 to get Table by T- Shirt:

    {=IFERROR(INDEX($A$88:$A$92,SMALL(IF($B$88:$B$92=$F88,ROW($A$88:$A$92)-MIN(ROW($A$88:$A$92))+1),COLUMNS($F$88:F88))),"")}

N.B.

  • Finish the Formula with Ctrl+Shift+Enter.
  • Fill Formula Down the Right.

  • Formula in Cell G94 to get Table by Name & Contact Number:

    =IFERROR(INDEX($A$88:$A$92,SMALL(IF($C$88:$C$92=$F94,ROW($A$88:$A$92)-MIN(ROW($A$88:$A$92))+1),COLUMNS($F$94:F94)))," ")&" "& IFERROR(INDEX($D$88:$D$92,SMALL(IF($C$88:$C$92=$F94,ROW($D$88:$D$92)-MIN(ROW($D$88:$D$92))+1),COLUMNS($F$94:F94)))," ")

N.B.

  • To avoid writing the Formula twice (Since Names are in Col A and Contact numbers in col D), once for Name and for Contact Number, I've Concatenated it, therefore Formula returns Name along with Contact Number in same Cell.
  • Finish the Formula with Ctrl+Shift+Enter.
  • Fill Formula Down the Right.