我有这个公式来提取一个以给定字符“@”开头的特定单词。它工作正常,但是,有更多的单词以相同的方式开头,它只会提取第一个单词。
如何让它全部提取?
=TRIM(LEFT(SUBSTITUTE(MID(B2,FIND("@",B2),LEN(B2))," ",REPT(" ",100)),100))
以下示例:
Seq Desc extracted
1 text @word @word
2 text @word_one and @word_two @word_one
答案 0 :(得分:0)
试试这个公式。它只是对你的配方略有修改。它的作用是,它搜索第一个@符号,而不是用~~替换它,并提取包含的单词。然后它搜索第二个@符号并执行相同的操作。
=CONCATENATE(TRIM(LEFT(SUBSTITUTE(MID(B3,FIND("~~",SUBSTITUTE(B3,"@","~~",1)),LEN(B3))," ",REPT(" ",100),1),100)),",",TRIM(LEFT(SUBSTITUTE(MID(B3,FIND("~~",SUBSTITUTE(B3,"@","~~",2)),LEN(B3))," ",REPT(" ",100),1),100)))
如果您想要添加第三个@ word来提取,只需添加另一个CONCATENATE实例,并将该公式的IFERROR(TRIM(LEFT(SUBSTITUTE(MID(B4,FIND("~~",SUBSTITUTE(B4,"@","~~",2(for third word replace value 2 with 3)),LEN(B4))
部分替换为第三次出现。因此,要提取3个值,请使用此公式。 (我添加了IFERROR部分,以防万一找不到字词)
=CONCATENATE(IFERROR(TRIM(LEFT(SUBSTITUTE(MID(B4,FIND("~~",SUBSTITUTE(B4,"@","~~",1)),LEN(B4))," ",REPT(" ",100),1),100)),""),",",IFERROR(TRIM(LEFT(SUBSTITUTE(MID(B4,FIND("~~",SUBSTITUTE(B4,"@","~~",2)),LEN(B4))," ",REPT(" ",100),1),100)),""),",",IFERROR(TRIM(LEFT(SUBSTITUTE(MID(B4,FIND("~~",SUBSTITUTE(B4,"@","~~",3)),LEN(B4))," ",REPT(" ",100),1),100)),""))