[英]Excel: Remove part of text string if a match is found in another column
I have a list of data with the company name and address. 我有一个包含公司名称和地址的数据列表。 However in the address column, the company name is joined with the address.
但是,在地址栏中,公司名称与地址结合在一起。 I want to know if it is possible to compare these 2 columns and remove the company name from the address.
我想知道是否可以比较这两列并从地址中删除公司名称。
See attached pic 见附件图片
将此粘贴到单元格c2中
IF(ISERROR(SEARCH(A2,B2,1)),B2,RIGHT(B2,LEN(B2)-LEN(A2)))
in column C use: 在C列中使用:
=TRIM(SUBSTITUTE(B2,Right(A2,len(A2)-find(" ",A2)),""))
The RIGHT function will strip off the leading number. RIGHT功能将删除开头的数字。
The SUBSTITUTE function replaces what is left of A2 that is found in B2 with nothing. SUBSTITUTE函数将B2中剩余的A2内容替换为空。
The TRIM function removes the leading space. TRIM功能消除了前导空间。
Just to be on the safe side in case there might be more than one space between the "." 为了安全起见,以防在“。”之间存在多个空格。 and the start of the name, or trailing spaces in the name.
以及名称的开头,或名称中的尾部空格。
=TRIM(SUBSTITUTE(B2,TRIM(Right(A2,len(A2)-find(" ",A2))),""))
Added a TRIM function to what is being pulled from column A. 向从列A拉出的内容添加了TRIM函数。
在C2中并填写:
=TRIM(SUBSTITUTE(B2,MID(A2,SEARCH(". ",A2,1)+2,500),""))
这么多的选择!
=RIGHT(B1,LEN(B1)-IFERROR(FIND(A1,B1,1),0))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.