so, a couple of issues
your setup for SQUADRA10 on Teams sheet is inconsistent with 1-9, so:
first - SQUADRA10 header should be in AB1 rather than AC1 (AC1 should be empty)
second - BARAK in AB2 should be "P" (currently listed in both AB2 & AC2, only latter is valid)
once you have fixed the above... regards Sheet2 calcs:
Formula:
M2: =IF(C2="";"";IFERROR(INDEX(Teams!$A$1:$AB$1;AGGREGATE(15;6;(COLUMN($B$1:$AC$1)-1)/((Teams!$B$2:$AC$29=C2));COLUMN(A1)));""))
N2: =IF($M2="";"";SUMPRODUCT((Teams!$B$2:$AC$29=$C2)*(Teams!$A$1:$AB$1=$M2);Teams!$C$2:$AD$29))
copied down
the SUMPRODUCT could be replaced with a SUMIF if you're only ever going to find a "player" in one "squad" -- the SUMPRODUCT assumes this may not be the case (could be in multiple squads whereas you only want value of first found)
Bookmarks