本帖最后由 edwin11891 于 2024-5-21 09:50 编辑
借用楼上30楼的公式,加上类似规划求解,对有效数字进行组合,得到公式如下。注意A11、A12,其实是部分之和,因此,结果应该是对应的部分之和。如果B列提取的数字无论怎样组合,都不能得到对应A列数据,则判断为数据有误。
- =LET(nlist,TAKE(--TEXTSPLIT(IFERROR(TEXTAFTER(B2,"合格品",1),B2),{"+缺角","kg/","块",","},"合格品",1),,4),n,ROWS(nlist),rs,IF(n=1,IFS(CHOOSECOLS(nlist,1)=A2,CHOOSECOLS(nlist,2),CHOOSECOLS(nlist,3)=A2,CHOOSECOLS(nlist,4),1,"数据误"),LET(t,REDUCE({0;1},SEQUENCE(n-1),LAMBDA(x,y,TOCOL(x&"-"&{0,1}))),s,--TEXTSPLIT(TEXTJOIN("@",,t),"-","@"),sBox,MMULT(s,nlist),FHG,XLOOKUP(A2,CHOOSECOLS(sBox,1),CHOOSECOLS(sBox,2),0,0),FQJ,XLOOKUP(A2,CHOOSECOLS(sBox,3),CHOOSECOLS(sBox,4),0,0),ss,IF(FHG>0,FHG,IF(FQJ>0,FQJ,"数据有误")),ss)),rs)
复制代码 |