Discussion Locked

Splitting text strings in Excel

0 helpful
10 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Is there a function that allows you to split a text string with a space (s)
> in it into two or three different cells?
>
> For example, folks around here do not create discrete fields for first
> name and last name, just one field such as Firstname Lastname. I like
> to use the information for a mail merge, but can not create a salutation
> using only the first name as it is not a discrete text string.
>
> Any ideas?
>
> Thank you.

10 replies

by mbarker734

Use this in a cell for each line. Change the A1 to the cell with the name you are looking to extract the first name from. This is assuming the format for the name entered is First Last. Then use that cell for your salutation.

=LEFT(A1,(FIND("",A1,1)-1))

Hope this helped,

Mark

by mbarker734

Ok I figured someone would question the fact that the first name may not be first.

If the last name is first:

=RIGHT(A1,(LEN(A1))-(FIND(" ",A1,1)))

If you want to know about how to deal with sometimes middle initials sometime not that will cost you some real points haha.

Good luck,

Mark

by lo

Hi - Above should work fine except ... If the field is entered LAST, FIRST you will get LAST, as the first name. If the Name is Robert , but Robert likes Bob, then ... If you have controll of the input process, you can set up discrete input fields for First, Last and 'prefered' so the entry would be Robert Last Bob. That makes it easier as you can then store as 3 fields. Again, assumes you have access/control to the input process. You can modify the above to proceass some (if the result of above has a ",", then the entry was most likely Last, First, etc.). Lo

by awilliams3

You may also want to tinker with the 'Text To Columns' feature found under the DATA menu in Excel. This feature acts much like the file import wizard for text files in that it allows you to specify a delimiter (space) and parses out a column of cells to multple columns based on the delimeter, and apply a base data type (text, date, number, etc.).

If trying this feature I suggest copying and pasting your column in question to another location with no data adjacent to it as I believe this feature will write over columns to the immediate right of the column being parsed (not too good).

This discussion is closed to new replies.