- =LET(g,LET(a,F2:F219,b,SCAN("",V2:V219,LAMBDA(k,l,IF(l="",k,l))),REDUCE("",{"在职","退休"},LAMBDA(X,y,VSTACK(X,REDUCE("",SEQUENCE(8,,30,10),LAMBDA(m,n,VSTACK(m,LET(t,IF(n=100,SUM((a>n-10)*(b=y)),SUM((a>n-10)*(a<=n)*(b=y))),u,IF(n=100,SUM((a>n-10)*(b=y)*(E2:E219="男")),SUM((a>n-10)*(a<=n)*(b=y)*(E2:E219="男"))),IF(t=0,"",IF(n=100,y&n-9&"岁以上的有"&t&"个人(其中男"&u&"人、女"&t-u&"人)",y&n-9&"-"&n&"岁的有"&t&"个人(其中男"&u&"人、女"&t-u&"人)")))))))))),LET(b,SCAN("",V2:V219,LAMBDA(k,l,IF(l="",k,l))),j,SUM(--(b="在职")),h,SUM(--(b="在职")*(E2:E219="男")),f,SUM(--(b="退休")*(E2:E219="男")),z,COUNT(F2:F219),VSTACK(FILTER(g,g<>""),"在职合计"&j&"人(其中男"&h&"人、女"&j-h&"人)","退休合计"&z-j&"人(其中男"&f&"人、女"&z-j-f&"人)","在职/退休总计"&z&"人(其中男"&h+f&"人、女"&z-h-f&"人)")))
复制代码 |