答案1
以下公式非常大,但它们有效:
=IF(OR(RIGHT(C2,1)="1",RIGHT(D2,1)="1",RIGHT(E2,1)="1"),TEXTJOIN("/",1,IF(RIGHT(C2,1)="1",LEFT(C2,2),""),IF(RIGHT(D2,1)="1",LEFT(D2,2),""),IF(RIGHT(E2,1)="1",LEFT(E2,2),"")),0)
稍微短一点数组公式版本:
=IF(OR(RIGHT(C2:E2,1)="1"),TEXTJOIN("/",1,IF(RIGHT(C2,1)="1",LEFT(C2,2),""),IF(RIGHT(D2,1)="1",LEFT(D2,2),""),IF(RIGHT(E2,1)="1",LEFT(E2,2),"")),0)
TEXTJOIN
当常规公式不可用时,可以使用更长的版本:
=IF(OR(RIGHT(C2,1)="1",RIGHT(D2,1)="1",RIGHT(E2,1)="1"),SUBSTITUTE(TRIM(IF(RIGHT(C2,1)="1",LEFT(C2,2),"") &" "& IF(RIGHT(D2,1)="1",LEFT(D2,2),"") &" "& IF(RIGHT(E2,1)="1",LEFT(IE2,2),""))," ","/"),0)