remove salutations

rakesh seebaruth

Active Member
Joined
Oct 6, 2011
Messages
303

Dear Guys

In Column A from A1:A500, I have e.g. Mr John Smith and Mr Mick Steeve


I need a formula or vba that would remove Mr and Mr and paste it in cell B

Thanks in advance.

regards

rakesh

 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Re: remove saluations

Hi,

Try this,

Code:
=MID(A3,3,100)

7254743b83dd29c10c196204575ef7cb.gif
 
Upvote 0
Re: remove saluations

Assuming that you could have other length salutations, I would suggest trying

=REPLACE(A1,1,FIND(" ",A1),"")
 
Upvote 0
Re: remove saluations

thanks but sorry my question was wrongly address

in cell A1 i have the names MR JACK SMITH AND MR JOHN THOMAS , i need to remove MR AND MR from cell A1 and paste it in Cell B2. i don't need the name and surname.

Thanks
 
Upvote 0
Re: remove saluations

Further questions on top of mandukes' ..

1. Do you have some cells with only one name?
2. Does every person have such a salutaion?
3. Do you have any salutations other than "Mr" (eg Mrs, Dr, Prof, ...)?
4. If there are 2 (or more) names in a cell, is there always " and " between them, or could it be " & " or something else?
5. What version of Excel are you using?

Finally, it would be very helpful to see a good representative set of dummy sample data and the expected results for that data. Say about 10 rows.
 
Upvote 0
Re: remove saluations

As per your requirement the code works with "Mr" keyword. It would removes all the occurrence of keyword "Mr" in cells.

Code:
Sub getRidMr()


Dim mStr  As String
Dim lastrow As Long
lastrow = Cells(Rows.count, "A").End(xlUp).Row
For i = 1 To lastrow
mStr = ActiveSheet.Range("A" & i)
mStr = Replace(mStr, "Mr", "")       '[COLOR=#ff0000] Replace the salutation to suit [/COLOR]
ActiveSheet.Range("B" & i) = mStr
Next i
5e3a51414e9a4919a670443870918a4a.gif
 
Last edited:
Upvote 0
Re: remove saluations

hi Peter

Please refer the following link https://www.dropbox.com/s/y1ahasea8ajebjf/TESTING212.xlsx?dl=0
expected results are in cells B2

in reply to your questions above

(1) i have twenty eight cells with different names
(2) each person their title differs
(3) There are salutations like Mr, Mr and Mrs ,Mrs ,Mr and Mr
(4) There is always "AND" between the names there is no Dr,Prof ,&
(5) Excel 2010.

What i am trying to do you is mail merge . I have to address letters to Bank Customers .Their titles are Mr ,Mrs ,Miss, Mr and Mr( if two borrowers have availed of a loan)

thanks/regards

rakesh
 
Upvote 0
Re: remove saluations

Thanks for the sample data. It isn't much like the sample in post #1 though since all cells have other text before the first salutation and there are many instances of multiple spaces between words. ;)

Due to the multiple spaces between words, I have employed a helper column.
I have also assumed from the sample data that ..
- All data is in upper case
- Never more than two names in a cell.

Excel Workbook
ABC
1CUST_NAMETRIM SPACESRESULT
2NUCK MR MOH IRSNUCK MR MOH IRSMR
3NUCK MR MOH IRSNUCK MR MOH IRSMR
4IYA MR PAINE AND MRS MARIE LOUISEIYA MR PAINE AND MRS MARIE LOUISEMR AND MRS
5IYA MR PAINE AND MRS MARIE LOUISEIYA MR PAINE AND MRS MARIE LOUISEMR AND MRS
6HU MR KAI AND MRS SHARMHU MR KAI AND MRS SHARMMR AND MRS
7BOO MR CHAND AND MRS PRISBOO MR CHAND AND MRS PRISMR AND MRS
8BOO MR CHAND AND MRS PRISBOO MR CHAND AND MRS PRISMR AND MRS
9RAMLO MRS PRATRAMLO MRS PRATMRS
10SOO MR SANDEV SINGH AND MRS MEESOO MR SANDEV SINGH AND MRS MEEMR AND MRS
11SAHO MR AB ABE AND MRS MARSAHO MR AB ABE AND MRS MARMR AND MRS
12GHOO MISS YEAGHOO MISS YEAMISS
13NUCK MR MOH IRSNUCK MR MOH IRSMR
14NUCK MR MOH IRSNUCK MR MOH IRSMR
15IYA MR PAINE AND MRS MARIE LOUISEIYA MR PAINE AND MRS MARIE LOUISEMR AND MRS
16IYA MR PAINE AND MRS MARIE LOUISEIYA MR PAINE AND MRS MARIE LOUISEMR AND MRS
17HU MR KAI AND MRS SHARMHU MR KAI AND MRS SHARMMR AND MRS
18BOO MR CHAND AND MRS PRISBOO MR CHAND AND MRS PRISMR AND MRS
19BOO MR CHAND AND MRS PRISBOO MR CHAND AND MRS PRISMR AND MRS
20RAMLO MRS PRATRAMLO MRS PRATMRS
21JACKE MR SMITH AND MR JOHN BEE1JACKE MR SMITH AND MR JOHN BEE1MR AND MR
22JACKS MR SMITH AND MR JOHN BEE2JACKS MR SMITH AND MR JOHN BEE2MR AND MR
23JACKY MR SMITH AND MR JOHN BEE3JACKY MR SMITH AND MR JOHN BEE3MR AND MR
24JACKEET MR SMITH AND MR JOHN BEE4JACKEET MR SMITH AND MR JOHN BEE4MR AND MR
25JACKRE MR SMITH AND MR JOHN BEE5JACKRE MR SMITH AND MR JOHN BEE5MR AND MR
Extract Salutation
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

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