M365写的公式,有点长,可能是想复杂了
=LET(fx,LAMBDA(x,TOCOL(IF(课表!B4:FM43&"">0,x))),a,IFNA(TOCOL(MAP(课表!B4:FM43,LAMBDA(x,INDEX(人事!C3:Q42,MATCH(INDEX(课表!A:A,ROW(x)),人事!A3:A42,),MATCH(x,人事!C2:Q2,))))),""),b,fx(课表!B4:FM43),c,FIND(b,CONCAT(人事!C2:Q2)),d,IFNA(MATCH(a,TOCOL(人事!C3:Q42,1,1),),""),pp,PIVOTBY(HSTACK(c,d,a,b),fx(SEQUENCE(,COLUMNS(课表!B3:FM3))),fx(课表!A4:A43&课表!B4:FM43),LAMBDA(x,TEXTJOIN("/",,x)),0,0,,0,),data,DROP(DROP(FILTER(pp,1-ISERROR(TAKE(pp,,1))),,2),1),HSTACK(VSTACK({"姓名","科目"},TAKE(data,,2)),VSTACK(MOD(SEQUENCE(,COLUMNS(课表!B3:FM3))-1,12)+1,DROP(data,,2))))
|