#1   Report Post  
someone
 
Posts: n/a
Default Extract text

Hi,

I would like to extract a section of text from a list of drawing numbers.

For example ....

LEFT\ADV CONT\S3JL081P0251 REV D.DWG

LEFT\ADV CONT\S3JL081P0252 REV E.DWG

LEFT\ADV CONT\S3JL081P0253 REV D.DWG

LEFT\ADV CONT\S4JL081P0254 REV E.DWG

LEFT\ADV CONT\S4JL081P0255 REV F.DWG

LEFT\ADV CONT\S4JL081P0256 REV F.DWG



The part I want to extract is anything inclusive from "S3" or "S4" to the
end of the text string but not including the ".dwg" part

Please could someone help me with a function string to do this ?

Thankyou


  #2   Report Post  
Niek Otten
 
Posts: n/a
Default

=MID(A1,15,18)

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"someone" wrote in message
...
Hi,

I would like to extract a section of text from a list of drawing numbers.

For example ....

LEFT\ADV CONT\S3JL081P0251 REV D.DWG

LEFT\ADV CONT\S3JL081P0252 REV E.DWG

LEFT\ADV CONT\S3JL081P0253 REV D.DWG

LEFT\ADV CONT\S4JL081P0254 REV E.DWG

LEFT\ADV CONT\S4JL081P0255 REV F.DWG

LEFT\ADV CONT\S4JL081P0256 REV F.DWG



The part I want to extract is anything inclusive from "S3" or "S4" to the
end of the text string but not including the ".dwg" part

Please could someone help me with a function string to do this ?

Thankyou




  #3   Report Post  
Vlad
 
Posts: n/a
Default

Try this:

MID(G6,FIND("S3",G6,1),FIND(".DWG",G6,1)-FIND("S3",G6,1))

where G6 is cell with the text.


"someone" wrote in message
...
Hi,

I would like to extract a section of text from a list of drawing numbers.

For example ....

LEFT\ADV CONT\S3JL081P0251 REV D.DWG

LEFT\ADV CONT\S3JL081P0252 REV E.DWG

LEFT\ADV CONT\S3JL081P0253 REV D.DWG

LEFT\ADV CONT\S4JL081P0254 REV E.DWG

LEFT\ADV CONT\S4JL081P0255 REV F.DWG

LEFT\ADV CONT\S4JL081P0256 REV F.DWG



The part I want to extract is anything inclusive from "S3" or "S4" to the
end of the text string but not including the ".dwg" part

Please could someone help me with a function string to do this ?

Thankyou




  #4   Report Post  
Dave R.
 
Posts: n/a
Default

Since these are of the same length and are set up the same way, you can use
'text to columns' from the Data menu. Choose "fixed width" then click in
the white portion of the "data preview" window to setup where you want the
separation done.



"someone" wrote in message
...
Hi,

I would like to extract a section of text from a list of drawing numbers.

For example ....

LEFT\ADV CONT\S3JL081P0251 REV D.DWG

LEFT\ADV CONT\S3JL081P0252 REV E.DWG

LEFT\ADV CONT\S3JL081P0253 REV D.DWG

LEFT\ADV CONT\S4JL081P0254 REV E.DWG

LEFT\ADV CONT\S4JL081P0255 REV F.DWG

LEFT\ADV CONT\S4JL081P0256 REV F.DWG



The part I want to extract is anything inclusive from "S3" or "S4" to the
end of the text string but not including the ".dwg" part

Please could someone help me with a function string to do this ?

Thankyou




  #5   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:

=MID(LEFT(A1,LEN(A1)-4),FIND("CONT\",A1)+5,255)

Or, if the drawing numbers all have the same form as shown:

=MID(A1,15,18)



In article ,
"someone" wrote:

Hi,

I would like to extract a section of text from a list of drawing numbers.

For example ....

LEFT\ADV CONT\S3JL081P0251 REV D.DWG

LEFT\ADV CONT\S3JL081P0252 REV E.DWG

LEFT\ADV CONT\S3JL081P0253 REV D.DWG

LEFT\ADV CONT\S4JL081P0254 REV E.DWG

LEFT\ADV CONT\S4JL081P0255 REV F.DWG

LEFT\ADV CONT\S4JL081P0256 REV F.DWG



The part I want to extract is anything inclusive from "S3" or "S4" to the
end of the text string but not including the ".dwg" part

Please could someone help me with a function string to do this ?

Thankyou



  #6   Report Post  
Gord Dibben
 
Posts: n/a
Default

If all drawing numbers are same length and format as your example you could
use DataText to Columns and Fixed Width.

Add or delete breaklines where you want the text isolated.


Gord Dibben Excel MVP

On Wed, 19 Jan 2005 18:12:19 GMT, "someone" wrote:

Hi,

I would like to extract a section of text from a list of drawing numbers.

For example ....

LEFT\ADV CONT\S3JL081P0251 REV D.DWG

LEFT\ADV CONT\S3JL081P0252 REV E.DWG

LEFT\ADV CONT\S3JL081P0253 REV D.DWG

LEFT\ADV CONT\S4JL081P0254 REV E.DWG

LEFT\ADV CONT\S4JL081P0255 REV F.DWG

LEFT\ADV CONT\S4JL081P0256 REV F.DWG



The part I want to extract is anything inclusive from "S3" or "S4" to the
end of the text string but not including the ".dwg" part

Please could someone help me with a function string to do this ?

Thankyou


  #7   Report Post  
Harlan Grove
 
Posts: n/a
Default

someone wrote...
I would like to extract a section of text from a list of drawing

numbers.

For example ....
LEFT\ADV CONT\S3JL081P0251 REV D.DWG
LEFT\ADV CONT\S3JL081P0252 REV E.DWG
LEFT\ADV CONT\S3JL081P0253 REV D.DWG
LEFT\ADV CONT\S4JL081P0254 REV E.DWG
LEFT\ADV CONT\S4JL081P0255 REV F.DWG
LEFT\ADV CONT\S4JL081P0256 REV F.DWG

The part I want to extract is anything inclusive from "S3" or "S4" to

the
end of the text string but not including the ".dwg" part


If all records start with 'LEFT\ADV CONT\', then you already have a few
workable answers. If records could start with other stuff, and if what
you want is equivalent to the base filename of partial pathname, i.e.,
everything after the rightmost '\' but excluding the first period to
the right of it and any subsequent text, then the general approach
would be using an array formula like

=LEFT(MID(x,MAX(IF(MID(x,seq,1)="\",seq))+1,1024),
FIND(".",MID(x,MAX(IF(MID(x,seq,1)="\",seq))+1,102 4))-1)

where x is the address of the cell you're parsing and seq is a defined
name referring to something like

=ROW(INDIRECT("1:1024"))

  #8   Report Post  
someone
 
Posts: n/a
Default

Thanks for all the replies . . .

Probably didn't make myself very clear on original post.

The preceding text could be anything except "S3" or "S4"

All the strings are of unequal length.


  #9   Report Post  
Harlan Grove
 
Posts: n/a
Default

someone wrote...
Probably didn't make myself very clear on original post.

The preceding text could be anything except "S3" or "S4"

All the strings are of unequal length.


Simpler (if longer) then.

=LEFT(MID(x,SEARCH("S3",SUBSTITUTE(x,"S4","S3")),1 024),
FIND(".",MID(x,SEARCH("S3",SUBSTITUTE(x,"S4","S3") ),1024))-1)

  #10   Report Post  
someone
 
Posts: n/a
Default


"Harlan Grove" wrote in message
oups.com...
someone wrote...
Probably didn't make myself very clear on original post.

The preceding text could be anything except "S3" or "S4"

All the strings are of unequal length.


Simpler (if longer) then.

=LEFT(MID(x,SEARCH("S3",SUBSTITUTE(x,"S4","S3")),1 024),
FIND(".",MID(x,SEARCH("S3",SUBSTITUTE(x,"S4","S3") ),1024))-1)


BRILLIANT !

Thank You

:-)




  #11   Report Post  
someone
 
Posts: n/a
Default


"someone" wrote in message
...

"Harlan Grove" wrote in message
oups.com...
someone wrote...
Probably didn't make myself very clear on original post.

The preceding text could be anything except "S3" or "S4"

All the strings are of unequal length.


Simpler (if longer) then.

=LEFT(MID(x,SEARCH("S3",SUBSTITUTE(x,"S4","S3")),1 024),
FIND(".",MID(x,SEARCH("S3",SUBSTITUTE(x,"S4","S3") ),1024))-1)


BRILLIANT !

Thank You

:-)


Could I be so bold to ask ........ Could you explain it to me please ?


  #12   Report Post  
Harlan Grove
 
Posts: n/a
Default

someone wrote...
....
=LEFT(MID(x,SEARCH("S3",SUBSTITUTE(x,"S4","S3") ),1024),
FIND(".",MID(x,SEARCH("S3",SUBSTITUTE(x,"S4","S 3")),1024))-1)


Could I be so bold to ask ........ Could you explain it to me please ?


You're looking for only "S3" or "S4". This works because these two
strings are the same length.

The SUBSTITUTE call replaces "S4" with "S3" if there are any instances
of "S4" in x; otherwise, it leaves x as-is.

The SEARCH call then locates the leftmost instance of "S3" in the
string returned by SUBSTITUTE, so the leftmost character position of
"S3" or "S4" in the original x.

The MID call extracts the portion of x starting with the leftmost "S3"
or "S4" to the right end of x. The 1024 as 3rd argument to MID is a
dummy large number. MID won't return more characters than are in its
string 1st argument, so using an arbitrarily large 3rd argument ensures
MID returns the remaining substring to the right of its starting
position 2nd argument.

The FIND call locates the leftmost "." *after* the leftmost "S3" or
"S4".

The LEFT call returns the portion of the MID call's result to the left
of the leftmost "." following (to the right of) the leftmost "S3" or
"S4" in x.

  #13   Report Post  
someone
 
Posts: n/a
Default

"Harlan Grove" wrote in message
ups.com...
someone wrote...
...
=LEFT(MID(x,SEARCH("S3",SUBSTITUTE(x,"S4","S3" )),1024),
FIND(".",MID(x,SEARCH("S3",SUBSTITUTE(x,"S4"," S3")),1024))-1)


Could I be so bold to ask ........ Could you explain it to me please ?


You're looking for only "S3" or "S4". This works because these two
strings are the same length.

The SUBSTITUTE call replaces "S4" with "S3" if there are any instances
of "S4" in x; otherwise, it leaves x as-is.

The SEARCH call then locates the leftmost instance of "S3" in the
string returned by SUBSTITUTE, so the leftmost character position of
"S3" or "S4" in the original x.

The MID call extracts the portion of x starting with the leftmost "S3"
or "S4" to the right end of x. The 1024 as 3rd argument to MID is a
dummy large number. MID won't return more characters than are in its
string 1st argument, so using an arbitrarily large 3rd argument ensures
MID returns the remaining substring to the right of its starting
position 2nd argument.

The FIND call locates the leftmost "." *after* the leftmost "S3" or
"S4".

The LEFT call returns the portion of the MID call's result to the left
of the leftmost "." following (to the right of) the leftmost "S3" or
"S4" in x.


Thank you so much for your help and efforts.

:-)


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
Can I extract text as a value from a formula? Amy O Excel Worksheet Functions 2 January 8th 05 12:41 AM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM
Macro or Function to make text size to suite text Length? lbbss Excel Discussion (Misc queries) 4 December 14th 04 07:53 PM
Extract % from text string Mike Excel Worksheet Functions 5 December 1st 04 08:02 PM
Extract Pixel Values to Excel? CR Optiker Excel Worksheet Functions 1 November 4th 04 10:47 PM


All times are GMT +1. The time now is 05:35 PM.

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"