如何在Excel中的子字符串之前和之后提取许多字符
在AIN列中,每个单元格中都有一大堆文本墙,并且BI中希望看到围绕关键字“气候变化”的信息段,以更好地理解上下文。为此,我只想在关键字之前提取100个字符,然后在关键字之后再提取100个字符。
我尝试了通常的左,右,查找中间功能,但无法弄清楚如何指定我需要
任何帮助的字符数量,谢谢
In Column A I have a large wall of text in each cell, and in Column B I want to see a snippet of information around the keyword "Climate Change" to better understand the context. For that, I want to only extract 100 characters before the keyword, and another 100 characters after the keyword.
I tried the usual left, right, find, mid functions but couldn't figure it out how to specify the number of characters i need
any help is appreciated, thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
= mid(a1,max(搜索(“气候变化”,a1)-100,1),214)
最大(x,1)在气候搜索之前没有100个字符时检查句柄,因为MID在起始位置参数小于1。
=MID(A1,MAX(SEARCH("climate change",A1)-100,1),214)
The Max(x,1) check handles when there aren't 100 characters before climate search, because Mid returns an error when the starting position parameter is less than 1.
您可以使用子函数。
=替换(a2,“气候变化”,“”)
如果要删除额外的空间,则使用trim
= trim(替换(a2,“气候变化”,“”))
You can use subtitute function.
=SUBSTITUTE(A2,"Climate Change","")
if you want to remove the extra spaces then use trim
=TRIM(SUBSTITUTE(A2,"Climate Change",""))