简体   繁体   English

在 Excel 中提取字符串 Beetwen 2 字符

[英]Extract String Beetwen 2 Character in Excel

I want the string in column A to be extracted to each column, where the position of the string taken between "d /" and "/ search".我希望将 A 列中的字符串提取到每一列,其中字符串的位置在“d /”和“/search”之间。

Based on the formula I made, it only extracts it in one column.根据我制作的公式,它只在一列中提取它。

我的桌子

In Cell B2, you already have the formula as:在单元格 B2 中,您已经有了如下公式:

=MID(A2,FIND("d/",A2)+2,FIND("/search",A2)-FIND("d/",A2)-2)

You are really close, you only needed to add the starting position as an argument for the following formulas, so it will start searching after the previously found string as below.您真的很接近,您只需要添加起始位置作为以下公式的参数,因此它将在先前找到的字符串之后开始搜索,如下所示。

In C2 add the following:在 C2 中添加以下内容:

=MID(A2,FIND("d/",A2,FIND(B2,A2))+2,FIND("/search",A2)-FIND("d/",A2)-2)

And in D2 the following:在 D2 中:

=MID(A2,FIND("d/",A2,FIND(C2,A2))+2,FIND("/search",A2)-FIND("d/",A2)-2)

If you have Office 365 Excel it can be done with one formula:如果您有 Office 365 Excel,则可以使用一个公式完成:

=CONCAT(IF(TRIM(MID(SUBSTITUTE(SUBSTITUTE($A2,"d/","|/",COLUMN(A:A)),"/",REPT(" ",99)),ROW($1:$100)*99,99))="|",TRIM(MID(SUBSTITUTE($A2,"/",REPT(" ",99)),ROW($2:$101)*99,99)),""))

this is an array formula, it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.这是一个数组公式,退出编辑模式时需要使用 Ctrl-Shift-Enter 而不是 Enter 确认。

在此处输入图片说明

Well, I'm certainly not going to retype all the sample data you left in an image for everyone to retype but try this in B2 then drag right and down,好吧,我当然不会重新输入您留在图像中的所有示例数据供所有人重新输入,但在 B2 中尝试此操作,然后向右和向下拖动,

在此处输入图片说明

Another way, Try this.另一种方法,试试这个。

Apply the below formula in Cell B2在单元格 B2 中应用以下公式

=TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," ")," ",REPT(" ",LEN(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," ")))), (2-1)*LEN(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," "))+1, LEN(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," "))))&", "&TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," ")," ",REPT(" ",LEN(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," ")))), (4-1)*LEN(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," "))+1, LEN(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," "))))&", "&TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," ")," ",REPT(" ",LEN(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," ")))), (6-1)*LEN(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," "))+1, LEN(SUBSTITUTE(SUBSTITUTE(A2,"d/"," "),"/search?"," "))))

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

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