ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Extract text between symbols (https://www.excelbanter.com/excel-discussion-misc-queries/140987-extract-text-between-symbols.html)

billinr

Extract text between symbols
 
I would like to extract text from a string which will contain:

<sometext/the text I want/<sometext

The beginning and ending text will vary in length, but the text I want will
be between the two "/".

I am also looking to extract the text after the second "/", in a different
operation.

The data will change, so I want to write this as a template.

Any help is appreciated.

Thanks

Ron Coderre

Extract text between symbols
 
With text in cel A1

Try something like this:
B1: =LEFT(MID(A1,FIND("/",A1)+1,255),FIND("/",MID(A1,FIND("/",A1)+1,255))-1)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"billinr" wrote:

I would like to extract text from a string which will contain:

<sometext/the text I want/<sometext

The beginning and ending text will vary in length, but the text I want will
be between the two "/".

I am also looking to extract the text after the second "/", in a different
operation.

The data will change, so I want to write this as a template.

Any help is appreciated.

Thanks


Don Guillett

Extract text between symbols
 
try this
Sub extracttext()
For Each c In Selection
fb = InStr(1, c, "/") + 1
'MsgBox fb
sb = InStr(fb + 1, c, "/")
'MsgBox sb
ms = Mid(c, fb, sb - fb)
MsgBox ms
rest = Right(c, Len(c) - sb)
MsgBox rest

Next c
End Sub

--
Don Guillett
SalesAid Software

"billinr" wrote in message
...
I would like to extract text from a string which will contain:

<sometext/the text I want/<sometext

The beginning and ending text will vary in length, but the text I want
will
be between the two "/".

I am also looking to extract the text after the second "/", in a different
operation.

The data will change, so I want to write this as a template.

Any help is appreciated.

Thanks



Ron Rosenfeld

Extract text between symbols
 
On Mon, 30 Apr 2007 12:12:01 -0700, billinr
wrote:

I would like to extract text from a string which will contain:

<sometext/the text I want/<sometext

The beginning and ending text will vary in length, but the text I want will
be between the two "/".

I am also looking to extract the text after the second "/", in a different
operation.

The data will change, so I want to write this as a template.

Any help is appreciated.

Thanks


If the strings are less than 256 characters long, then you could download and
install Longre's free (and easily distributable) morefunc.xll add-in from
http://xcell05.free.fr/.

Then use this formula:

=REGEX.MID(A1,"(?<=/).*?(?=/)")


--ron

Ron Rosenfeld

Extract text between symbols
 
On Mon, 30 Apr 2007 15:59:04 -0400, Ron Rosenfeld
wrote:

On Mon, 30 Apr 2007 12:12:01 -0700, billinr
wrote:

I would like to extract text from a string which will contain:

<sometext/the text I want/<sometext

The beginning and ending text will vary in length, but the text I want will
be between the two "/".

I am also looking to extract the text after the second "/", in a different
operation.

The data will change, so I want to write this as a template.

Any help is appreciated.

Thanks


If the strings are less than 256 characters long, then you could download and
install Longre's free (and easily distributable) morefunc.xll add-in from
http://xcell05.free.fr/.

Then use this formula:

=REGEX.MID(A1,"(?<=/).*?(?=/)")


--ron


Oh, for the text after the second "/"

=REGEX.SUBSTITUTE(A1,".*/.*/")
--ron

billinr

Extract text between symbols
 
Thank you. This worked well for the text between the symbols.
Could you offer something that would find the text after the second "/"?

TIA

"Ron Coderre" wrote:

With text in cel A1

Try something like this:
B1: =LEFT(MID(A1,FIND("/",A1)+1,255),FIND("/",MID(A1,FIND("/",A1)+1,255))-1)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"billinr" wrote:

I would like to extract text from a string which will contain:

<sometext/the text I want/<sometext

The beginning and ending text will vary in length, but the text I want will
be between the two "/".

I am also looking to extract the text after the second "/", in a different
operation.

The data will change, so I want to write this as a template.

Any help is appreciated.

Thanks


T. Valko

Extract text between symbols
 
Try this:

=MID(A1,FIND("/",A1,FIND("/",A1)+1)+1,255)

Biff

"billinr" wrote in message
...
Thank you. This worked well for the text between the symbols.
Could you offer something that would find the text after the second "/"?

TIA

"Ron Coderre" wrote:

With text in cel A1

Try something like this:
B1:
=LEFT(MID(A1,FIND("/",A1)+1,255),FIND("/",MID(A1,FIND("/",A1)+1,255))-1)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"billinr" wrote:

I would like to extract text from a string which will contain:

<sometext/the text I want/<sometext

The beginning and ending text will vary in length, but the text I want
will
be between the two "/".

I am also looking to extract the text after the second "/", in a
different
operation.

The data will change, so I want to write this as a template.

Any help is appreciated.

Thanks





All times are GMT +1. The time now is 07:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com