Parse string out to different cells

kwagner1

Active Member
Joined
Jun 10, 2003
Messages
445
Greetings,

I have the following string in cell A2 thru A2000 (6 fields concatenated into 1 cell)
GLB MO;GW TCH;ADV WL MK;CL FIN REL ;CL FIN DIS;CLI FN DS

I want: to use a formula to parse out the 6 fields into seperate cols in excel.
Col B2 = GLB MO
Col C2 = GW TCH
Col D2 = ADV WL
etc....

How can I best obtain the desired result via an Excel formula? (i know i can manually use "text to columns" but i want to avoid the manual steps.)

Thanks!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi

Try this in A2 copied across:

=TRIM(LEFT(SUBSTITUTE(REPLACE(";"&$A2,1,FIND("@",SUBSTITUTE(";"&$A2,";","@",COLUMNS($A$2:A$2))),""),";",REPT(" ",100),1),100))
 
Upvote 0
not sure how often changes are made to the worksheet, but you could copy the following inot the "On Change" function, or put it into a command button.

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Range("A1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=True, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1)), _
        TrailingMinusNumbers:=True
End Sub

I have noticed that the on change gets annoying, so maybe put it into a command button.
 
Upvote 0
beautifule thing guys !!! I went with the formula appraoch rather than the code. Thanks !!!!
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,485
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top