删除以某些字符开头的整个单词的公式 [英] Formula to remove entire words that start with certain characters

查看:147
本文介绍了删除以某些字符开头的整个单词的公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个公式,搜索所有出现的 http 的字符串,并删除整个链接。例如:

 这是有史以来最好的故事http://www.usatoday.com确保阅读两次。 http://www.usatoday.com/image.jpg 

将成为:

 这是最好的故事,确保读取两次。 

从我所看到的,应该这样做:

  = TRIM(LEFT(A1,FIND(http,A1)-1))& RIGHT(A1,LEN(A1)-FIND( A1,FIND(http,A1))+ 1)

但是我仍然得到 #VALUE!



我希望能够让代码在串。另外,如果没有找到URL,我只想重新打印原始字符串。



任何想法?

解决方案

请尝试:

  = TRIM(REPLACE(A1,FIND(http://,A1)),IFERROR(FIND(,A1,FIND http://,A1)),LEN(A1)+9)-FIND(http://,A1)+1,))
pre>

如果您希望删除URLS,不仅仅是在句子结尾。



IMO从@Siddharth Rout提供的以下编辑提供了比上述更好的解决方案。






非VBA /非公式方法


  1. 新闻 CTRL + H 带来查找和替换对话框。

  2. 中查找什么,键入http:// *,不带引号。注意 *

  3. 替换为为空。

  4. 点击替换全部

  5. 现在在 code>,键入http:// *,不带引号。注意在 * 之后没有空格

  6. 保持替换为 li>
  7. 点击替换全部

而你完成了。


I want a formula that searches a string for all occurrences of http and removes that entire link. For instance:

This is the best story ever http://www.usatoday.com make sure to read it twice. http://www.usatoday.com/image.jpg

would become:

This is the best story ever make sure to read it twice.

From what I've read, this should do it:

 =TRIM(LEFT(A1,FIND("http",A1)-1))&RIGHT(A1,LEN(A1)-FIND(" ",A1,FIND("http",A1))+1)

but I'm still getting #VALUE!.

I'd like to be able to have the code find the URL at any point in the string. Also, if no URL is found, I'd just like the original string reprinted.

Any ideas?

解决方案

Please try:

=TRIM(REPLACE(A1,FIND("http://",A1),IFERROR(FIND(" ",A1,FIND("http://",A1)),LEN(A1)+9)-FIND("http://",A1)+1,""))  

if you're looking to remove URLS not just at end of sentence.

IMO the following edit from @Siddharth Rout provides a better solution than the above.


Non VBA / Non Formula Method

  1. Press CTRL + H to bring the Find And Replace Dialog Box.
  2. In Find What, type "http://* " without the quotes. Notice there is a space after *
  3. Keep the Replace With empty.
  4. Click Replace All
  5. Now in Find What, type "http://*" without the quotes. Notice there no space after *
  6. Keep the Replace With empty
  7. Click Replace All

And you are done.

这篇关于删除以某些字符开头的整个单词的公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆