Separating salutations from random data in MS-Excel

Beethoven123

New Member
Joined
Mar 23, 2018
Messages
3
I am trying to remove the salutations from an excel column. The column contains random data. Some names have prefix "Mr.", "Mrs." and some have nothing before the. For example:
  • Ms. John Doe
  • Mr. John Doe
  • John Doe

What can I do in this case to remove the "Ms." and "Mrs." without affecting the prefix-less word?

Thanks in advance.
 

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
Welcome to the Board.

A couple options:

Let's say your column is A, and the first entry is Ms. John Doe. Put "John Doe" in B1 (no quotes). Then with B1 selected, press Control+E. This activates Flash-Fill, and it will try to create entries that match the pattern of the example you just entered. If there are other changes you want, like removing Jr. or something from the end, clear column B, find an entry in A like that, enter the way you want it, then try Control+E again.

Or you could try this formula in B1:

=TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"Ms.",""),"Mr.",""),"Mrs.",""),"Dr.",""))

and drag down.
 
Upvote 0
Hi,

Here's another way:


Book1
ABC
1Ms. John DoeJohn Doe
2Mr. John DoeJohn Doe
3John DoeJohn Doe
4Miss Jane DoeJane Doe
5Mrs. DoeDoe
6Dr. Eric WEric W
Sheet31
Cell Formulas
RangeFormula
C1=TRIM(IFERROR(MID(A1,FIND(".",A1)+1,255),SUBSTITUTE(A1,"Miss","")))


You're on the list Eric:)
 
Upvote 0
Here's a macro solution where you can add or remove salutations to fit your sheet. Change the column letter to match the column your names are in. Do this on a copy of your sheet to ensure its doing what you want because the changes cannot be reversed.
Code:
Sub ClearSalutations()
Dim Salutations
Salutations = Array("Mr. ", "Ms. ", "Dr. ", "Reverend ", "Professor ") ' add any pertinent salutations you wish here
Application.ScreenUpdating = False
With Columns("A")  'replace A with your column letter(s)
    For Each sal In Salutations
        .Replace sal, "", xlPart
    Next sal
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
You're welcome, welcome to the forum.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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