你可以使用这个:
=MID(A1,FIND("@",SUBSTITUTE(LEFT(A1,FIND(",",A1))," ","@",LEN(LEFT(A1,FIND(",",A1)))-LEN(SUBSTITUTE(LEFT(A1,FIND(",",A1))," ",""))))+1,LEN(A1))
这将返回:
Yucaipa, CA 992399
Hesperia, CA 92345
Victorville, CA 92345
根据您的测试数据。
如果你的文本中有@
符号,你可以试试这个:
=MID(A1,FIND(CHAR(1),SUBSTITUTE(LEFT(A1,FIND(",",A1))," ",CHAR(1),LEN(LEFT(A1,FIND(",",A1)))-LEN(SUBSTITUTE(LEFT(A1,FIND(",",A1))," ",""))))+1,LEN(A1))
解释
=LEFT(A1,FIND(",",A1))
给34470 Yucaipa Boulevard Yucaipa,
. 我们称这个位为“文本”。
=SUBSTITUTE(Text," ","@",LEN(Text)-LEN(SUBSTITUTE(Text," ","")))
. 该位是用 替换最后一个空格实例@
。的第 4 个参数SUBSTITUTE
给出了要替换的空格的实例,并LEN(Text)-LEN(SUBSTITUTE(Text," ",""))
给出了文本中空格的数量。你得到34470 Yucaipa Boulevard@Yucaipa,
这部分的结果
然后,对此进行操作MID
以获得@
直到结束的位置。