Spliting Middle and Last Names Issue

bencar

Banned user
Joined
Jun 8, 2016
Messages
149
I wish to split the following names into separate cells. Entries with 1st, middle and last names are split normally into 3 separate columns. But entries with no middle names have an issue. Their last names are placed in the 2nd column as if it were their middle names. How can I fix it so that the last name of entries with no middle name go to the 3rd column (for last names) instead of the 2nd column which is reserved for middle names?

ann edwards sarah
yolanda m. dara
herman lopez
miike z. boro
jen yanna

<tbody>
</tbody>
 
Last edited:
Using AlKey's suggestion...
A​
B​
C​
D​
1​
ann edwards sarahannedwardssarah
2​
yolanda m. darayolandam.dara
3​
herman lopezhermanlopez
4​
miike z. boromiikez.boro
5​
jen yannajenyanna
6​
Ron de BruinRondeBruin
7​
Eric von LustbardenEricvonLustbarden
8​
John den HarverJohndenHarver
9​
John Smith 3rdJohnSmith3rd
10​
Mary Miller SnrMaryMillerSnr

This shows my point even better
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Enter formula in B1 and pull it across to cell D1 and then down
=TRIM(MID(SUBSTITUTE(" "&IF(LEN($A1)-LEN(SUBSTITUTE($A1," ",""))=1,SUBSTITUTE($A1," "," "),$A1)," ",REPT(" ",50)),50*COLUMNS($A:A),50))

Excel 2016 (Windows) 32 bit
ABCD
1
ann edwards sarah
annedwardssarah
2yolanda m. darayolandam.dara
3herman lopezhermanlopez
4miike z. boromiikez.
boro
5jen yannajen
yanna

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet3

I did as you asked. But I still get 'Lopez' in the C column, not D column.

Also, how were you able to paste your excel sheet in your previous post?
 
Upvote 0
But you got a delimiter as space in between the names. I'm sure theres a formula to split the names accordingly with that.
Yes, if the names contain just 2 words, a 1 word first name and a 1 word last name, then it's fairly simple to parse those names:

John Smith
Karen Kolter

However, when names have more than 2 words it gets complicated.

Betty Jo Spickerman
Eddie Van Halen

Betty Jo is the first name and Spickerman is the last name.

Eddie is the first name and Van Halen is the last name.

Both names are 3 words. So, what logic can we use to tell Excel that the first example has a 2 word first name but the second example has a 2 word last name?

We can't just use the number of space characters. They both have the same number of space characters but the space needed to split is not the same.
 
Upvote 0
I did as you asked. But I still get 'Lopez' in the C column, not D column.

Also, how were you able to paste your excel sheet in your previous post?

This is because there is a trailing spaces. Remove trailing space from herman lopez and the formula will readjust.
 
Upvote 0
This is because there is a trailing spaces. Remove trailing space from herman lopez and the formula will readjust.

I dont understand. What do you mean by trailing space and where are they in 'herman lopez'? I checked in the cell and I dont see extra spaces before or after 'herman lopez'.
 
Upvote 0
I dont understand. What do you mean by trailing space and where are they in 'herman lopez'? I checked in the cell and I dont see extra spaces before or after 'herman lopez'.

I added trim function that will remove extra spaces
Try this
=TRIM(MID(SUBSTITUTE(" "&IF(LEN(TRIM($A1))-LEN(SUBSTITUTE(TRIM($A1)," ",""))=1,SUBSTITUTE(TRIM($A1)," "," "),TRIM($A1))," ",REPT(" ",50)),50*COLUMNS($A:A),50))
 
Upvote 0
I added trim function that will remove extra spaces
Try this
=TRIM(MID(SUBSTITUTE(" "&IF(LEN(TRIM($A1))-LEN(SUBSTITUTE(TRIM($A1)," ",""))=1,SUBSTITUTE(TRIM($A1)," "," "),TRIM($A1))," ",REPT(" ",50)),50*COLUMNS($A:A),50))

I still get the same result. After I paste your formula and drag the cells across and down the result is still the same.
 
Upvote 0
Regardless of whether the formula works, you are still left with the situation that it will never be 100% reliable/accurate, based on the comments made above
 
Upvote 0
All formulas worked find for me. This would be the last try.
=TRIM(MID(SUBSTITUTE(" "&IF(LEN(TRIM($A1))-LEN(SUBSTITUTE(TRIM($A1)," ",""))=1,SUBSTITUTE(TRIM($A1)," ",REPT(" ",2)),TRIM($A1))," ",REPT(" ",50)),50*COLUMNS($A:A),50))
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,978
Members
448,934
Latest member
audette89

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