几个条件合在一起生成一个条码
各位大佬好,有个问题请帮忙解决一下,几个条件合在一起生成一个条码,请看附件。写的有点长,公式里面有重复的部分,要是能使用新函数LET就好了
=LEFT(SUBSTITUTE(A2,LEFT(A2,FIND("-",A2)),LEFT("2021010000",LEN(B2)-LEN(A2)+LEN(LEFT(A2,FIND("-",A2))))),2*LEN(SUBSTITUTE(A2,LEFT(A2,FIND("-",A2)),LEFT("2021010000",LEN(B2)-LEN(A2)+LEN(LEFT(A2,FIND("-",A2))))))-LENB(SUBSTITUTE(A2,LEFT(A2,FIND("-",A2)),LEFT("2021010000",LEN(B2)-LEN(A2)+LEN(LEFT(A2,FIND("-",A2))))))) 有LET函数就可以简化很多
=LET(x,SUBSTITUTE(A2,LEFT(A2,FIND("-",A2)),LEFT("2021010000",LEN(B2)-LEN(A2)+LEN(LEFT(A2,FIND("-",A2))))),LEFT(x,2*LEN(x)-LENB(x))) 修改下,以下面为准:
=SUBSTITUTE(LEFT(A2,2*LEN(A2)-LENB(A2)),LEFT(A2,FIND("-",A2)),LEFT("2021010000",LEN(B2)-LEN(LEFT(A2,2*LEN(A2)-LENB(A2)))+LEN(LEFT(A2,FIND("-",A2)))))
有LET函数
= LET(x,LEFT(A2,2*LEN(A2)-LENB(A2)),SUBSTITUTE(x,LEFT(A2,FIND("-",A2)),LEFT("2021010000",LEN(B2)-LEN(x)+LEN(LEFT(A2,FIND("-",A2)))))) 笨方法
=$A$1&TEXT(LEFT(A2,FIND("-",A2)-1),"00")&TEXT(IFERROR(MAX(--MID(A2,FIND("-",A2)+1,ROW($1:$5))),MAX(IFERROR(--MID(A2,FIND("-",A2)+1,ROW($1:$5)),))),"0000")&SUBSTITUTE(CHAR(64+SUM(IFERROR(ROW($1:$26)*(FIND(CHAR(64+ROW($1:$26)),A2)>0),))),"@",) =A$1&TEXT(LEFT(A2,FIND("-",A2)-1),"00")&TEXT(MID(A2,FIND("-",A2)+1,LOOKUP(1,-MID(A2,ROW($1:9),1),ROW($1:9))-FIND("-",A2)),"0000")&REPT(RIGHTB(A2),CODE(RIGHTB(A2))>64) =CONCATENATE($A$1,TEXT(LEFT(A2,FIND("-",A2)-1),"00"),TEXT(MID(A2,FIND("-",A2)+1,LEN(LOOKUP(10^6,--MID(A2,FIND("-",A2)+1,ROW($1:$10))))),"0000"),IF(OR(ISNUMBER(--RIGHT(A2)),LEN(RIGHT(A2))<>LENB(RIGHT(A2))),"",RIGHT(A2))) 谢谢各位大佬 =$A$1/1%%%+SUM(MID(SUBSTITUTE(LEFT(A2,LOOKUP(9,-MID(A2,ROW($1:$9),1),ROW($1:$9))),"-",REPT(" ",9)),{1,10},9)*10^{4,0})&IF(CODE(RIGHT(A2))>64,RIGHT(A2),"")
字母的处理比较麻烦,如果还是末尾的。 =A$1*100+LEFT(A2,FIND("-",A2)-1)&TEXT(LOOKUP(999,1*MID(MID(A2,FIND("-",A2)+1,9),1,ROW(A$1:A$9))),"0000")&IF((RIGHT(A2)>="a")*(RIGHT(A2)<"吖"),RIGHT(A2),"")
页:
[1]