Removing single variable characters within a cell

jnathan

New Member
Joined
Jul 8, 2013
Messages
48
I need to remove the letter within the middle of a persons name.

For example, if the person is called 'Michael J Fox' then it needs to be edited to show only 'Michael Fox', if the person is called 'George W Bush' then only 'George Bush' should be displayed etc. However the persons name should remain as is if a middle character initial does not exist.

Can anyone help with a formula or macro to resolve this issue?

Any help will be really appreciated.

Many thanks

Justin R Nathan ;)
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
=if(len(j1)-len(substitute(j1," ",""))>1,left(j1,find(" ",j1)-1)&" "&right(j1,len(j1)-find(" ",j1,find(" ",j1)+1)),j1)
 
Upvote 0
I need to remove the letter within the middle of a persons name.

For example, if the person is called 'Michael J Fox' then it needs to be edited to show only 'Michael Fox', if the person is called 'George W Bush' then only 'George Bush' should be displayed etc. However the persons name should remain as is if a middle character initial does not exist.

Can anyone help with a formula or macro to resolve this issue?
Select the entire column of names, then press CTRL+H to bring up the Replace dialog box... type <space>?<space> using a single space character in place of each <space> that I showed (so you will type a space, a question mark and then another space) into the "Find what" field... type a single space into the "Replace with" field... click the "Options>>" button and make sure there is NO checkmark in the "Match entire cell contents" checkbox... finish off by clicking the "Replace All" button.
 
Upvote 0
Wow. That's cool. You learn something new every day. And I would bet that you're not going to get any better perfomance than that using formulas or macros.

The only problem is if the data has various periods after the middle initial as happens often with data entry. Sometimes they put the period, sometimes not.

But, that's fixed easily enough by changing the search criteria from " ? " to " ?. "

Nice Rick.
 
Upvote 0

Forum statistics

Threads
1,221,417
Messages
6,159,789
Members
451,589
Latest member
Harold14

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