Seperating Text String

Gian624

Board Regular
Joined
Jul 23, 2009
Messages
92
Hello Everyone,

I have a single text string of names from Outlook seperated by a semi-colon that are in one cell in excel. I am looking for a formula to seperate those 30 plus names into seperate cells. Does anyone have a formula that will do that?

eg: John Smith; Jane Doe; John Doe; Jane Smith

John Smith
Jane Doe
John Doe
Jane Smith

Thank you,
Matt
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Would Using Text To Columns with a semicolon delimiter and then copy and paste special with the transpose option selected satisfy your needs? Avoids complex formulas or VBA
 
Upvote 0
Matt,

Her are options but both involve use of vba.

1......
Copy this code to the sheet module. Assuming your string is in A1 it will create a column list starting in A1

Code:
Sub Sep_Names()
arr = Split(ActiveSheet.Range("A1"), ";")
For r = LBound(arr) To UBound(arr)
Cells(r + 1, 1).Value = Trim(arr(r))
Next r
End Sub


or 2.......

Paste this function into a code Module ( F11 Insert Module ) and then use a formula eg as below.

Code:
Function SepNames(Str As String, Prt As Integer)
SepNames = Trim(Split(Str, ";")(Prt))
End Function



Excel 2007
A
1Jane Doe;Fred Jones ; John Smith
2Jane Doe
3Fred Jones
4John Smith
5
Sheet1
Cell Formulas
RangeFormula
A2=IFERROR(SepNames($A$1,ROWS(A$1:A1)-1),"")


Hope that helps.
 
Upvote 0
Hello Everyone,

I have a single text string of names from Outlook seperated by a semi-colon that are in one cell in excel. I am looking for a formula to seperate those 30 plus names into seperate cells. Does anyone have a formula that will do that?

eg: John Smith; Jane Doe; John Doe; Jane Smith

John Smith
Jane Doe
John Doe
Jane Smith

Thank you,
Matt
Assuming your list has a space after each semi-colon and is located in cell A1, put this formula in cell A2 and copy down for as many rows as you think you will ever need...

=TRIM(MID(SUBSTITUTE(A$1,"; ",REPT(" ",300)),ROW(A1)*300-299,300))
 
Upvote 0
Assuming your list has a space after each semi-colon and is located in cell A1, put this formula in cell A2 and copy down for as many rows as you think you will ever need...

=TRIM(MID(SUBSTITUTE(A$1,"; ",REPT(" ",300)),ROW(A1)*300-299,300))

Rick,

When you use the above structure it requires that you substitute an adequate number of spaces, otherwise it will error when parsing the back end of the string or may error on a long sub-string.

Would you please tell me.......
Do you have a rule of thumb for determining how many spaces you insert? (Substrings*Expected length?)

Is there a limit beyond which you could not employ this approach?
 
Upvote 0

Forum statistics

Threads
1,223,712
Messages
6,174,031
Members
452,542
Latest member
Bricklin

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