Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Extracting Text between 2nd and 3rddelimiter

hi,

i have the following text:

AAA_llac_MAR_99_eg

i am trying to write a formula to extract the text between the second
and third occurance of '_" (the delimiter). Basically i want to
extract MAR. I am trying to do this using the MID and FIND statement.

Any help would be appreciated!

db
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Extracting Text between 2nd and 3rddelimiter

Maybe this

=MID(MID(MID(SUBSTITUTE(A1,"_","^",A2),1,256),FIND ("^",SUBSTITUTE(A1,"_","^",A2)),256),2,FIND("_",MI D(MID(SUBSTITUTE(A1,"_","^",A2),1,256),FIND("^",SU BSTITUTE(A1,"_","^",A2)),256))-2)

A1 is your string and A2 tells it where to start extraction from, in this
case the send "_" so A2 is 2
Mike

" wrote:

hi,

i have the following text:

AAA_llac_MAR_99_eg

i am trying to write a formula to extract the text between the second
and third occurance of '_" (the delimiter). Basically i want to
extract MAR. I am trying to do this using the MID and FIND statement.

Any help would be appreciated!

db

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Extracting Text between 2nd and 3rddelimiter

Maybe a bit more flexible, try this:-

=MID(MID(MID(SUBSTITUTE(A1,A3,"^",(A2-1)),1,256),FIND("^",SUBSTITUTE(A1,A3,"^",(A2-1))),256),2,FIND(A3,MID(MID(SUBSTITUTE(A1,A3,"^",( A2-1)),1,256),FIND("^",SUBSTITUTE(A1,A3,"^",(A2-1))),256))-2)

A1= Your string
A2= number of the word to extract (As written this formula won't extract the
first word)
A3 = Delimeter (In your case _)

Mike

" wrote:

hi,

i have the following text:

AAA_llac_MAR_99_eg

i am trying to write a formula to extract the text between the second
and third occurance of '_" (the delimiter). Basically i want to
extract MAR. I am trying to do this using the MID and FIND statement.

Any help would be appreciated!

db

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Extracting Text between 2nd and 3rddelimiter

thanks! i did a crude solution using find, mid and len. but i like
your formulae better!

db
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting text Guy Lydig Excel Discussion (Misc queries) 7 March 30th 07 10:12 AM
Extracting Text from the right L Ellis Excel Worksheet Functions 6 July 8th 05 08:15 PM
EXTRACTING TEXT EstherJ Excel Discussion (Misc queries) 3 December 16th 04 05:27 PM
extracting certain text lost!! Excel Programming 4 December 7th 04 05:01 PM
extracting text from within a cell - 'text to rows@ equivalent of 'text to columns' Dan E[_2_] Excel Programming 4 July 30th 03 06:43 PM


All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"