Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default Text string extraction

Can anyone suggest a one-stop formula to extract partial data from a
string. I can do it in perhaps two/three steps, but I havent fathomed how to
do it in one step. If the following data is in column A, from A2 down.:

IC.0.0.863259.0.0.0
IC.0.Z28002.163119.0.0.0
IC.ITME.G80101.567149.0.0.0
IC.ITSE.0.769348.0.0.0
IC.SSSKP.G90312.567149.0.0.0

.I would like to extract the information between the first full stop and
the third full stop, so that the result in column B2 down is as follows:

0.0
0.Z28002
ITME.G80101
ITSE.0
SSSKP.G90312

The difficulty I am facing is that the element after the first full stop can
be any length from 1 character to 5 characters, and the element after the
second full stop can be up to 6 characters in length.

Thanks in advance for any help you can give.

--
Geoff
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Text string extraction

If the desired text always begins with the 4th character...

Try this:
=MID(A1,4,SEARCH("|",SUBSTITUTE(A1,".","|",3))-4)

But, if the prefix length may vary....
=MID(A1,FIND(".",A1)+1,FIND("|",SUBSTITUTE(A1,".", "|",3))-FIND(".",A1)-1)

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Geoffric" wrote in message
...
Can anyone suggest a "one-stop" formula to extract partial data from a
string. I can do it in perhaps two/three steps, but I haven't fathomed how
to
do it in one step. If the following data is in column A, from A2 down..:

IC.0.0.863259.0.0.0
IC.0.Z28002.163119.0.0.0
IC.ITME.G80101.567149.0.0.0
IC.ITSE.0.769348.0.0.0
IC.SSSKP.G90312.567149.0.0.0

..I would like to extract the information between the first full stop and
the third full stop, so that the result in column B2 down is as follows:

0.0
0.Z28002
ITME.G80101
ITSE.0
SSSKP.G90312

The difficulty I am facing is that the element after the first full stop
can
be any length from 1 character to 5 characters, and the element after the
second full stop can be up to 6 characters in length.

Thanks in advance for any help you can give.

--
Geoff




  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Text string extraction

Try this UDF:

Function first_to_third(r As Range) As String
s = Split(r.Value, ".")
first_to_third = s(1) & "." & s(2)
End Function

--
Gary''s Student - gsnu200761


"Geoffric" wrote:

Can anyone suggest a one-stop formula to extract partial data from a
string. I can do it in perhaps two/three steps, but I havent fathomed how to
do it in one step. If the following data is in column A, from A2 down.:

IC.0.0.863259.0.0.0
IC.0.Z28002.163119.0.0.0
IC.ITME.G80101.567149.0.0.0
IC.ITSE.0.769348.0.0.0
IC.SSSKP.G90312.567149.0.0.0

.I would like to extract the information between the first full stop and
the third full stop, so that the result in column B2 down is as follows:

0.0
0.Z28002
ITME.G80101
ITSE.0
SSSKP.G90312

The difficulty I am facing is that the element after the first full stop can
be any length from 1 character to 5 characters, and the element after the
second full stop can be up to 6 characters in length.

Thanks in advance for any help you can give.

--
Geoff

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Text string extraction

One way:

=MID(LEFT(A1,FIND("$",SUBSTITUTE(A1,".","$",3))-1),FIND(".",A1)+1,255)


In article ,
Geoffric wrote:

Can anyone suggest a one-stop formula to extract partial data from a
string. I can do it in perhaps two/three steps, but I havent fathomed how to
do it in one step. If the following data is in column A, from A2 down.:

IC.0.0.863259.0.0.0
IC.0.Z28002.163119.0.0.0
IC.ITME.G80101.567149.0.0.0
IC.ITSE.0.769348.0.0.0
IC.SSSKP.G90312.567149.0.0.0

.I would like to extract the information between the first full stop and
the third full stop, so that the result in column B2 down is as follows:

0.0
0.Z28002
ITME.G80101
ITSE.0
SSSKP.G90312

The difficulty I am facing is that the element after the first full stop can
be any length from 1 character to 5 characters, and the element after the
second full stop can be up to 6 characters in length.

Thanks in advance for any help you can give.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Text string extraction

=MID(A1,FIND(".",A1)+1,FIND(".",A1,FIND(".",A1,FIN D(".",A1)+1)+1)-FIND(".",A1)-1)


"Geoffric" wrote:

Can anyone suggest a one-stop formula to extract partial data from a
string. I can do it in perhaps two/three steps, but I havent fathomed how to
do it in one step. If the following data is in column A, from A2 down.:

IC.0.0.863259.0.0.0
IC.0.Z28002.163119.0.0.0
IC.ITME.G80101.567149.0.0.0
IC.ITSE.0.769348.0.0.0
IC.SSSKP.G90312.567149.0.0.0

.I would like to extract the information between the first full stop and
the third full stop, so that the result in column B2 down is as follows:

0.0
0.Z28002
ITME.G80101
ITSE.0
SSSKP.G90312

The difficulty I am facing is that the element after the first full stop can
be any length from 1 character to 5 characters, and the element after the
second full stop can be up to 6 characters in length.

Thanks in advance for any help you can give.

--
Geoff



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Text string extraction

Gary''s Student wrote...
Try this UDF:

Function first_to_third(r As Range) As String
s = Split(r.Value, ".")
first_to_third = s(1) & "." & s(2)
End Function

....

OP didn't mention which Excel version he's using. Your udf would fail
in Excel 97 and prior under Windows and all Mac versions of Excel
because the Split function was introduced in VBA 6.
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
Help with Text import and data extraction Jim G Excel Discussion (Misc queries) 19 December 21st 07 05:07 AM
Sumif text is contained winthin a longer text string in a cell Johnny M[_2_] Excel Worksheet Functions 3 March 21st 07 02:50 PM
Complicated extraction of text lohwk Excel Discussion (Misc queries) 7 May 28th 06 09:36 PM
Splitting a text string into string and number mcambrose Excel Discussion (Misc queries) 4 February 21st 06 03:47 PM
String Extraction... iceberg27 Excel Worksheet Functions 2 October 15th 05 04:28 AM


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