简体   繁体   English

Excel:根据另一个单元格(字符串)删除部分单元格(字符串)

[英]Excel: Remove part of cell (String) based on another cell (String)

I have two columns/cells that look like this:我有两列/单元格,如下所示:

Column A A列 Column B B列
Word123 Word123 Word1 Word12 Word123 Word1234字 1 字 12 字 123 字 1234

My question: How can I remove the "Word123" (value of Column A) inside Column B so that the value of Column B looks like this: Word1 Word12 Word1234我的问题:如何删除 B 列中的“Word123”(A 列的值),以便 B 列的值如下所示:Word1 Word12 Word1234

Note that in Column B there is always one space character betweens these values and I have a lot of rows that need this kind of processing.请注意,在 B 列中,这些值之间始终有一个空格字符,我有很多行需要这种处理。

I have tried using the SUBSTITUTE Function but that doesnt seem to do the trick我试过使用 SUBSTITUTE Function 但这似乎没有用

Try the following formula-试试下面的公式-

=LET(x,TEXTSPLIT(B2,," "),TEXTJOIN(" ",1,FILTER(x,COUNTIFS(A2,x)=0)))

在此处输入图像描述

SUBSTITUTE works fine too... But you need to use some extra spaces to separate the strings clearly: SUBSTITUTE 也可以正常工作......但是你需要使用一些额外的空格来清楚地分隔字符串:

=TRIM(SUBSTITUTE(" " & B1 & " " ; " " & A1 & " " ; " "))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM