A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Formula Help to Extract Partial Data from a String



 
 
Thread Tools Display Modes
  #1  
Old March 10th, 2009, 11:46 PM posted to microsoft.public.excel.worksheet.functions
Steph
external usenet poster
 
Posts: 169
Default Formula Help to Extract Partial Data from a String

I have data that looks like this:

S30 1M D C7D
S30 1M D
5W I 4
2W I X AH1

I need a formula that will extract the third group of characters from each
record. The records can be any length and the groups are seperated by
spaces. For example,

From "S30 1M D C7D" I need to extract "D".
From "S30 1M D" I need to extract "D".
From "5W I 4" I need to extract "4".
From "2W I X AH1" I need to extract "X".

Thanks for any help that can be provided.

--
Steph

--
Steph
  #2  
Old March 11th, 2009, 12:23 AM posted to microsoft.public.excel.worksheet.functions
Pete_UK
external usenet poster
 
Posts: 8,780
Default Formula Help to Extract Partial Data from a String

If you highlight the data and click on Data | Text-to-columns, then
choose delimited with space as the delimiter, then the characters you
require will be in the third column.

Hope this helps.

Pete

On Mar 10, 11:46*pm, Steph wrote:
I have data that looks like this:

S30 1M D *C7D
S30 1M D
5W *I *4
2W *I *X *AH1

I need a formula that will extract the third group of characters from each
record. *The records can be any length and the groups are seperated by
spaces. *For example,

From "S30 1M D *C7D" I need to extract "D".
From "S30 1M D" I need to extract "D".
From "5W *I *4" I need to extract "4".
From "2W *I *X *AH1" I need to extract "X".

Thanks for any help that can be provided.

--
Steph

--
Steph


  #3  
Old March 11th, 2009, 12:48 AM posted to microsoft.public.excel.worksheet.functions
T. Valko
external usenet poster
 
Posts: 15,759
Default Formula Help to Extract Partial Data from a String

Assuming there will *always* be at least 3 groups of characters.

Broken into chunks so line wrap doesn't take out the needed space
characters.

=LEFT(MID(A2,FIND(" ",A2,FIND
(" ",A2)+1)+1,255),FIND
(" ",MID(A2&" ",FIND(" ",A2,FIND
(" ",A2)+1)+1,255))-1)


--
Biff
Microsoft Excel MVP


"Steph" wrote in message
...
I have data that looks like this:

S30 1M D C7D
S30 1M D
5W I 4
2W I X AH1

I need a formula that will extract the third group of characters from each
record. The records can be any length and the groups are seperated by
spaces. For example,

From "S30 1M D C7D" I need to extract "D".
From "S30 1M D" I need to extract "D".
From "5W I 4" I need to extract "4".
From "2W I X AH1" I need to extract "X".

Thanks for any help that can be provided.

--
Steph

--
Steph



  #4  
Old March 11th, 2009, 03:39 AM posted to microsoft.public.excel.worksheet.functions
Ashish Mathur[_2_]
external usenet poster
 
Posts: 1,764
Default Formula Help to Extract Partial Data from a String

Hi,

This is an alternative solution.

=MID(E17,SEARCH(" ",E17,SEARCH(" ",E17,1)+1)+1,IF(ISERROR(SEARCH("
",E17,SEARCH(" ",E17,SEARCH(" ",E17,1)+1)+1)-SEARCH(" ",E17,SEARCH("
",E17,1)+1)),50,SEARCH(" ",E17,SEARCH(" ",E17,SEARCH("
",E17,1)+1)+1)-SEARCH(" ",E17,SEARCH(" ",E17,1)+1)))

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Steph" wrote in message
...
I have data that looks like this:

S30 1M D C7D
S30 1M D
5W I 4
2W I X AH1

I need a formula that will extract the third group of characters from each
record. The records can be any length and the groups are seperated by
spaces. For example,

From "S30 1M D C7D" I need to extract "D".
From "S30 1M D" I need to extract "D".
From "5W I 4" I need to extract "4".
From "2W I X AH1" I need to extract "X".

Thanks for any help that can be provided.

--
Steph

--
Steph


  #5  
Old March 21st, 2009, 12:29 PM posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
external usenet poster
 
Posts: 3,719
Default Formula Help to Extract Partial Data from a String

On Tue, 10 Mar 2009 16:46:11 -0700, Steph
wrote:

I have data that looks like this:

S30 1M D C7D
S30 1M D
5W I 4
2W I X AH1

I need a formula that will extract the third group of characters from each
record. The records can be any length and the groups are seperated by
spaces. For example,

From "S30 1M D C7D" I need to extract "D".
From "S30 1M D" I need to extract "D".
From "5W I 4" I need to extract "4".
From "2W I X AH1" I need to extract "X".

Thanks for any help that can be provided.

--
Steph


One other method. You could download and install Longre's free morefunc.xll
add-in (Google for a download site), and then use this Regular Expression
formula:

=REGEX.MID(A1,"\w+",3)

--ron
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:29 AM.


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