简体   繁体   English

Excel-按特定字符串拆分单元格值?

[英]Excel - split cell value by specific string?

I have cells that contain a lot of text, but all of them contain string "RTG Actions: ". 我的单元格包含很多文本,但是所有单元格都包含字符串“ RTG Actions:”。 I would like to remove the text before the string ("RTG Actions: ") and keep only the text after it. 我想删除字符串(“ RTG Actions:”)之前的文本,并仅保留其后的文本。

I have a formula that almost does the job: 我有一个几乎可以完成工作的公式:

=RIGHT(P6,LEN(P6)-FIND("RTG",P6))

Unfortunately it keeps also a part of the string with it. 不幸的是,它也保留了一部分字符串。 ie "TG Actions: eams will leverage the Command and Control framework to..." 即“ TG行动:eams将利用Command and Control框架来...”

Could you advise me, how can I remove "TG Actions: ", please? 您能告诉我,如何删除“ TG Actions:”?

Many thanks! 非常感谢!

You can use RIGHT or MID function (I prefer MID here): 您可以使用RIGHTMID函数(我在这里更喜欢MID ):

=RIGHT(P6,LEN(P6)-FIND("RTG Actions:",P6)-LEN("RTG Actions:"))

=MID(P6, FIND("RTG Actions:",P6)+LEN("RTG Actions:"), LEN(P6))

For the MID FIND gets the beginning index of "RTG Actions:" and adds the length of it to get the starting point LEN(P6) ensures you get all the remaining characters. 对于MID FIND获取“ RTG动作:”的开始索引,并添加其长度以获取起点LEN(P6)确保您获取所有剩余字符。

Here is another option using the SEARCH function. 这是使用SEARCH功能的另一个选项。 It is essentially the same as the above, but just using a different function. 基本上与上述相同,只是使用了不同的功能。

Since your string to search for is constant, I just swapped LEN("RTG Actions: ") with it's character count (13 if you include a lagging space) 由于您要搜索的字符串是恒定的,因此我只将LEN("RTG Actions: ")替换为它的字符数(如果包含空格则为13)

=MID(P6,SEARCH("RTG Actions:",P6)+13,LEN(P6))

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

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