#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 184
Default Text Extractions

I am trying to extract the characters prior to the "-" but using the left,
mid, or right formula I am required to specify the exact number of
characters. In this case, the "-" is inconsistent on each row. Please help -
I am sure it is something simple but can't seem to find it.

WS1-GREdf-7R22ddd-MWS
WSde-GREa-7R25a-MWSad
WS-GREdfdd-7R32ada-ddddMWS
WSa-GRE-7PC7a-MWSddd

Goal is to easily get WS1 in one column, GREdf in the second, 7R22ddd in the
third, and MWS in the last column. However, each row has more or less
characters prior to each "-".

thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default Text Extractions

Try datatext to columns, delimited and select - as delimiter.
Do it on a test range first to make sure it works the way you want.

Btw, in this case it was easy but I don't understand why you would expect
that. Normally
Excel is very hard to use for text string parsing


--


Regards,


Peo Sjoblom


"Nikki" wrote in message
...
I am trying to extract the characters prior to the "-" but using the left,
mid, or right formula I am required to specify the exact number of
characters. In this case, the "-" is inconsistent on each row. Please
help -
I am sure it is something simple but can't seem to find it.

WS1-GREdf-7R22ddd-MWS
WSde-GREa-7R25a-MWSad
WS-GREdfdd-7R32ada-ddddMWS
WSa-GRE-7PC7a-MWSddd

Goal is to easily get WS1 in one column, GREdf in the second, 7R22ddd in
the
third, and MWS in the last column. However, each row has more or less
characters prior to each "-".

thanks



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,047
Default Text Extractions

Hello Nikki,
Assuming data stars on row 6 and column B

1st column (C)
=left(b6,find("-",b6,1)-1)

2nd column (D)
=MID(B6,LEN(C6)+2,FIND("-",B6,LEN(C6)+2)-LEN(C6)-2)

3rd column (E)
=MID(B6,LEN(C6)+LEN(D6)+3,FIND("-",B6,(LEN(C6)+LEN(D6)+3))-(LEN(C6)+LEN(D6)+3))

4th column (F)
=RIGHT(B6,LEN(B6)-(LEN(C6)+LEN(D6)+LEN(E6)+3))

hth
--
regards from Brazil
Thanks in advance for your feedback.
Marcelo



"Nikki" escreveu:

I am trying to extract the characters prior to the "-" but using the left,
mid, or right formula I am required to specify the exact number of
characters. In this case, the "-" is inconsistent on each row. Please help -
I am sure it is something simple but can't seem to find it.

WS1-GREdf-7R22ddd-MWS
WSde-GREa-7R25a-MWSad
WS-GREdfdd-7R32ada-ddddMWS
WSa-GRE-7PC7a-MWSddd

Goal is to easily get WS1 in one column, GREdf in the second, 7R22ddd in the
third, and MWS in the last column. However, each row has more or less
characters prior to each "-".

thanks

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Text Extractions

If you are willing to entertain a macro solution...

Sub SplitOnDashes()
Dim X As Long
Dim C As Range
Dim S() As String
For Each C In Intersect(Selection, ActiveSheet.UsedRange)
S = Split(C.Value, "-")
For X = 0 To UBound(S)
C.Offset(0, X).Value = S(X)
Next
Next
End Sub

Rick


"Nikki" wrote in message
...
I am trying to extract the characters prior to the "-" but using the left,
mid, or right formula I am required to specify the exact number of
characters. In this case, the "-" is inconsistent on each row. Please
help -
I am sure it is something simple but can't seem to find it.

WS1-GREdf-7R22ddd-MWS
WSde-GREa-7R25a-MWSad
WS-GREdfdd-7R32ada-ddddMWS
WSa-GRE-7PC7a-MWSddd

Goal is to easily get WS1 in one column, GREdf in the second, 7R22ddd in
the
third, and MWS in the last column. However, each row has more or less
characters prior to each "-".

thanks


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
grab cell text from multi-tab workbook, show text in another workb pfa Excel Worksheet Functions 16 August 10th 07 08:50 PM
Text does not display in "Text boxs" and when wrapping text in a c Esteban Excel Discussion (Misc queries) 1 March 8th 07 11:59 PM
Counting a mixed text/number column based on text in another colum Sierra Vista Steve Excel Discussion (Misc queries) 3 December 17th 06 05:30 PM
merged cells into one text cell, size varies dependant on text dat Jazzylady825 Excel Discussion (Misc queries) 0 December 9th 05 08:26 PM
want to remove all text characters equal to one character in length from text string [email protected] Excel Worksheet Functions 1 April 18th 05 09:56 PM


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