Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Separating prefixes in names

Hi All,

I am trying to combine and organize a bunch of SL spreadsheets for a
charity. Some of the worksheets have first and last names. Some have
everything in one column which may include prefixes such as "Mr.", "Mr. and
Mrs.", "Dr. and Mrs." etc. Many of the entries don't have a prefix. I can
separate the words by using the text-to-column program but the first and last
names don't line up because of the prefixes.

I know outlook can break them up automatically but is there a way to do it
in Excel?

Thanks, sh
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Separating prefixes in names

Select the cells that you wish to modify and run this simple macro:

Sub TitleKiller()
titles = Array("Mr. ", "Mrs. ", "Miss. ")
U = UBound(titles)
For Each r In Selection
v = r.Value
For i = 0 To U
v = Replace(v, titles(i), "")
Next
r.Value = v
Next
End Sub

As coded, the macro will only handle Mr. Mrs. and Miss.

Add additional titles to the array statement.


Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm
--
Gary''s Student - gsnu200860


"luthierwnc" wrote:

Hi All,

I am trying to combine and organize a bunch of SL spreadsheets for a
charity. Some of the worksheets have first and last names. Some have
everything in one column which may include prefixes such as "Mr.", "Mr. and
Mrs.", "Dr. and Mrs." etc. Many of the entries don't have a prefix. I can
separate the words by using the text-to-column program but the first and last
names don't line up because of the prefixes.

I know outlook can break them up automatically but is there a way to do it
in Excel?

Thanks, sh

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Separating names Stewart99 Excel Discussion (Misc queries) 2 August 17th 07 01:53 AM
separating first and last names Tom G. Excel Discussion (Misc queries) 10 September 4th 06 04:20 PM
Separating Names in a Cell Motaad Excel Discussion (Misc queries) 3 August 17th 06 04:26 PM
separating names mikeyVo Excel Worksheet Functions 2 July 20th 06 04:46 PM
Separating names Danno Excel Worksheet Functions 5 October 31st 05 12:29 AM


All times are GMT +1. The time now is 07:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"