Using Right Command based on number of characters? Maybe a different solution?

TWTHOMAS

Board Regular
Joined
Mar 26, 2010
Messages
96
I have a huge personnel data set that contains a tremendous number of employees.
Unfortunatley for me someone decided long ago that they would inlcude suffix's and sirnames and such to the middle inital without adding a space. Also some have a comma after the last name and others don't.



So I have names like

Johnson Ben AJR
Thomas, James EIII
Jones Trent R
Mitchell, Jaime

Anyone have a formula that will both remove the comma after the last name if there is one and also break the III's and JR's and Sr's and I's from the middle initial if they exist?


What I would like is results like this where each name part is in a different column with commas removed and the middle initial :

.......A.............B.............C..................D................
1.. Johnson..... Ben......... A................. JR
2.. Thomas..... James.......E ..................III
3.. Jones ........Trent........R
4.. Mitchell...... Jaime

Assuming all my names are in Column A and start at A2 can you give me a formula to do this?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try (untested so make a backup)
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,", "," "),"JR"," JR"),"III"," III"),"SR"," SR")

This assumes there are no names that contain III, JR or SR.
Watch out for foreign names that may break this rule.
 
Upvote 0
If this is a once only event, you can use Text to Columns
1 Select column A Data > Text to Columns - Delimited > Next then check both Space & Comma then Finish
2 select column C Data > Text to Columns - Fixed Width > Next then click on the 1st division on the ruler so a vertical line appears after the 1st character & Finish

HTH
 
Upvote 0
@Fluff: That wont separate the III, JRs or SRs from the initial letter as requested
 
Upvote 0
@Fluff: That wont separate the III, JRs or SRs from the initial letter as requested
The procedure Fluff laid out in his post worked for me (except for removing the possible comma after the last name which could be handled by using Excel's Replace dialog box). Perhaps you missed item #2 in his post?
 
Last edited:
Upvote 0
I used Special K99's formula and that worked prefect for splitting everything into just a space with no commas.

I am then able to use this to devide text to colums based on a formula.

=TRIM(MID(SUBSTITUTE($A1," ",REPT(" ",LEN($A1))),((COLUMNS($A1:A1)-1)*LEN($A1))+1,LEN($A1)))

This gives me the exact results I need! Thanks!

The reason I am not using text to columns the standard way is that I am building this as a 'drop the data into sheet 1' type thing to
create a mail merge for leangth of service awards. Way easier than teaching the clerk who prints them out how to use excel.
 
Upvote 0
The reason I am not using text to columns the standard way is that I am building this as a 'drop the data into sheet 1' type thing to
create a mail merge for leangth of service awards. Way easier than teaching the clerk who prints them out how to use excel.
Makes a lot of sense.
Thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,370
Members
449,080
Latest member
Armadillos

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