Manipulating names

Ricky_Mamba

New Member
Joined
Jan 9, 2015
Messages
5
I have a query with either a single name or joint names separated by a comma in one field:

Examples:

Mr Mike Bloggs
Mr Fred Smith, Mrs Jean Smith
Mr Richard Jones, Mrs Sally Sugar
Mrs Alice Springs, Mr John Springs

Using the above examples, I need a new field as follows:

Mr M Bloggs
Mr & Mrs F & J Smith
Mr & Mrs R & S Jones & Sugar (as different surnames)
Mr & Mrs J & A Springs (ideally, in this example, where there is Mrs & Mr, the Mr & associated initial comes first).

Thanks
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
If your entries will always have exactly two words in their name - no middle initials, no "Mary Ann Whatevers" - then you can use the Instr() function in a VBA module to look for spaces (" "), and then for the letter or word immediately following those spaces.

It will be a little bit of work, which is why most databases store first and last names in separate fields.

Let me know if you have trouble.
 
Upvote 0
Thanks for your reply, but I'm struggling a bit, as have never written a VBA module before. Any further help would be appreciated.
 
Upvote 0

Forum statistics

Threads
1,221,905
Messages
6,162,772
Members
451,786
Latest member
CALEB23

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