如果欄位不多,可以參考這用法,如果有重複的人名,可能就會按語法順序先取得第一個群組
=IF(IFNA(VLOOKUP(某個人名,組別A名單,1,FALSE),"")="",IF(IFNA(VLOOKUP(某個人名,組別B名單,1,FALSE),"")="","",回傳組別2),回傳組別1)
J2:
=INDEX(A1:G1,SUMPRODUCT(($B$3:$G$12=$J$1)X(COLUMN($B$3:$G$12))))
或
=INDEX(A1:G1,SUM(($B$3:$G$12=$J$1)X(COLUMN($B$3:$G$12))))
向下複製公式到J3