- =SUM(CHOOSECOLS(LET(zz,LET(z,LET(x,IFS(H304="1#线",FILTER(直接查询,(直接查询[[ 产线]]="中试线焊接热封")+(直接查询[[ 产线]]="1号COS焊接热封")),OR(H304="2#线",H304="3#线"),FILTER(直接查询,(直接查询[[ 产线]]="3号COS焊接热封")+(直接查询[[ 产线]]="2号COS焊接热封"))),y,IFS(H304="1#线",FILTER('模具需求-新增生产计划时刷新'!$I$6:$I$1003,'模具需求-新增生产计划时刷新'!$J$6:$J$1003=E304,""),OR(H304="2#线",H304="3#线"),FILTER('模具需求-新增生产计划时刷新'!$O$6:$O$1003,'模具需求-新增生产计划时刷新'!$P$6:$P$1003=E304,"")),FILTER(x,IF(ISNUMBER(XLOOKUP(CHOOSECOLS(x,3),y,y,0)),0,1))),jz,IFERROR(TAKE(CHOOSECOLS(LET(tt,IFS(AND(OR(H304="2#线",H304="3#线"),AND(L304<>"报废",L304<>"外协涂层")),FILTER(入库明细!$D$10:$L$10000,(入库明细!$H$10:$H$10000="2#线")+(入库明细!$H$10:$H$10000="3#线")),AND(H304="1#线",AND(L304<>"报废",L304<>"外协涂层")),FILTER(入库明细!$D$10:$L$10000,入库明细!$H$10:$H$10000="1#线")),FILTER(tt,(CHOOSECOLS(tt,1)>=D304)*(CHOOSECOLS(tt,9)<>"涂层回司")*(CHOOSECOLS(tt,2)&CHOOSECOLS(tt,3)=E304&F304))),1),1),0),ck,IFERROR(LET(qq,IF(OR(H304="2#线",H304="3#线"),FILTER($D$10:$H$10000,(($H$10:$H$10000="2#线")+($H$10:$H$10000="3#线"))*($L$10:$L$10000<>"报废")*($L$10:$L$10000<>"外协涂层")),FILTER($F$10:$F$10000,($H$10:$H$10000="1#线")*($L$10:$L$10000<>"报废")*($L$10:$L$10000<>"外协涂层"))),FILTER(qq,(CHOOSECOLS(qq,1)>=D304)*(CHOOSECOLS(qq,1)<=jz)*(CHOOSECOLS(qq,2)=E304)*(LEFT(CHOOSECOLS(qq,3),2)<>LEFT(F304,2)))),""),rk,IFERROR(LET(mm,IF(OR(H304="2#线",H304="3#线"),FILTER(入库明细!$D$10:$H$10000,(入库明细!$H$10:$H$10000="2#线")+(入库明细!$H$10:$H$10000="3#线")),FILTER(入库明细!$F$10:$F$10000,入库明细!$H$10:$H$10000="1#线")),FILTER(mm,(CHOOSECOLS(mm,1)>=D304)*(CHOOSECOLS(mm,1)<=jz)*(CHOOSECOLS(mm,2)=E304)*(LEFT(CHOOSECOLS(mm,3),2)<>LEFT(F304,2)))),""),IFS(AND(ck="",rk=""),FILTER(z,(CHOOSECOLS(z,2)>=D304)*(CHOOSECOLS(z,2)<=jz)),AND(ck<>"",rk<>"",TAKE(CHOOSECOLS(ck,1),1)<TAKE(CHOOSECOLS(rk,1),1)),IFNA(VSTACK(IFERROR(FILTER(z,(CHOOSECOLS(z,2)<TAKE(CHOOSECOLS(ck,1),1))*(CHOOSECOLS(z,2)>=D304)*(LEFT(CHOOSECOLS(z,1),1)=(LEFT(TAKE(CHOOSECOLS(ck,5),1),1)))),""),IFERROR(FILTER(z,(CHOOSECOLS(z,2)<=jz)*(LEFT(CHOOSECOLS(z,1),1)=(LEFT(TAKE(CHOOSECOLS(rk,5),1),1))))*(CHOOSECOLS(z,2)>TAKE(CHOOSECOLS(rk,1),1)),""),FILTER(z,(CHOOSECOLS(z,2)>=D304)*(CHOOSECOLS(z,2)<=jz)*(LEFT(CHOOSECOLS(z,1),1)=LET(a,LEFT(TAKE(CHOOSECOLS(ck,5),1),1),IFS(a="2","3",a="3","2"))),"无")),""),AND(ck<>"",rk<>"",TAKE(CHOOSECOLS(ck,1),1)>TAKE(CHOOSECOLS(rk,1),1)),FILTER(z,(CHOOSECOLS(z,2)>=D304)*(CHOOSECOLS(z,2)<=jz)*(LEFT(CHOOSECOLS(z,1),1)=LEFT(H304,1))),AND(ck<>"",rk=""),IFNA(VSTACK(IFERROR(FILTER(z,(CHOOSECOLS(z,2)>=D304)*(LEFT(CHOOSECOLS(z,1),1)=(IF(LEFT(H304,1)="2","3","2")))*(CHOOSECOLS(z,2)<TAKE(CHOOSECOLS(ck,1),1))),""),FILTER(z,(CHOOSECOLS(z,2)>=D304)*(CHOOSECOLS(z,2)<=jz)*(LEFT(CHOOSECOLS(z,1),1)=LEFT(H304,1)))),""),AND(ck="",rk<>""),IFNA(VSTACK(IFERROR(FILTER(z,(CHOOSECOLS(z,2)<=jz)*(LEFT(CHOOSECOLS(z,1),1)=(IF(LEFT(H304,1)="2","3","2")))*(CHOOSECOLS(z,2)>TAKE(CHOOSECOLS(rk,1),1))),""),FILTER(z,(CHOOSECOLS(z,2)>=D304)*(CHOOSECOLS(z,2)<=jz)*(LEFT(CHOOSECOLS(z,1),1)=LEFT(H304,1)))),""))),IF(OR(ISNUMBER(FIND("、",LET(a,CHOOSECOLS(zz,2),b,CHOOSECOLS(zz,1),SCAN("",UNIQUE(a),LAMBDA(x,y,TEXTJOIN("、",TRUE,UNIQUE(IF(a=y,b,""))))))))),FILTER(zz,LEFT(CHOOSECOLS(zz,1),1)=(LEFT(H304,1))),zz)),4))
复制代码
|