#1   Report Post  
EstherJ
 
Posts: n/a
Default EXTRACTING TEXT

I want to extract some text from a cell. The text can appear anwhere within
the string such as "OCXO STP 2337A VAR 1 10 MHZ". The text always beings
with "STP" but can appear as follows:

STP 1234
STP 1234A
STP-1234
STP-1234A
STP1234
STP1234A

I have tried the formula =MID(A152,FIND("STP",A152),8) but the MID is
looking for 8 characters and the number of characters are variable.

Thank you in advance.

Esther


  #2   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
try the following formulas:
A1: Source string

B1: Start position:
=FIND("STP",A1)

C1: End position:
=FIND(" ",A1,B1+5)

D1: Result:
=MID(A1,B1,C1-B1)

of course you could also combine this to one formula:
=MID(A1,FIND("STP",A1),FIND(" ",A1,FIND("STP",A1)+5)-FIND("STP",A1))

--
Regards
Frank Kabel
Frankfurt, Germany
"EstherJ" schrieb im Newsbeitrag
...
I want to extract some text from a cell. The text can appear anwhere
within
the string such as "OCXO STP 2337A VAR 1 10 MHZ". The text always beings
with "STP" but can appear as follows:

STP 1234
STP 1234A
STP-1234
STP-1234A
STP1234
STP1234A

I have tried the formula =MID(A152,FIND("STP",A152),8) but the MID is
looking for 8 characters and the number of characters are variable.

Thank you in advance.

Esther




  #3   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

If the string after always is "VAR" you could use this

=TRIM(MID(A1,FIND("STP",A1),FIND("VAR",A1)-FIND("STP",A1)))

Regards,

Peo Sjoblom

"EstherJ" wrote:

I want to extract some text from a cell. The text can appear anwhere within
the string such as "OCXO STP 2337A VAR 1 10 MHZ". The text always beings
with "STP" but can appear as follows:

STP 1234
STP 1234A
STP-1234
STP-1234A
STP1234
STP1234A

I have tried the formula =MID(A152,FIND("STP",A152),8) but the MID is
looking for 8 characters and the number of characters are variable.

Thank you in advance.

Esther


  #4   Report Post  
hagen
 
Posts: n/a
Default

Couldn't you perhaps use the "Text to Columns" feature?

Highlight the row you want to break apart. (Make sure you have empty rows
to the right by the number you will be breaking apart)
Click DataText to Columns
Choose Fixed Width for this case
Place line to seperate your text from the STP and click finish.



"EstherJ" wrote:

I want to extract some text from a cell. The text can appear anwhere within
the string such as "OCXO STP 2337A VAR 1 10 MHZ". The text always beings
with "STP" but can appear as follows:

STP 1234
STP 1234A
STP-1234
STP-1234A
STP1234
STP1234A

I have tried the formula =MID(A152,FIND("STP",A152),8) but the MID is
looking for 8 characters and the number of characters are variable.

Thank you in advance.

Esther


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
Import comma delimited text Lin Excel Discussion (Misc queries) 3 July 28th 06 04:07 PM
How do I rotate a text box Kent Charts and Charting in Excel 2 December 17th 04 12:13 AM
Hide text that doesn't fit in the cell Rene Excel Discussion (Misc queries) 1 December 16th 04 04:34 PM
Macro or Function to make text size to suite text Length? lbbss Excel Discussion (Misc queries) 4 December 14th 04 07:53 PM
Text Boxes Graham Parkinson Excel Discussion (Misc queries) 2 December 2nd 04 05:01 PM


All times are GMT +1. The time now is 11:16 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"