The e-mail marketing blog RSS 2.0
 Tuesday, January 29, 2008

Today I've been working in a small (just 97 lines of code) Excel VBA macro that can be somewhat useful. This utility allows you to split up columns of data that contain Names and Surnames mixed, so that you get two new columns with this elements separated.

It is able to correctly split names in several formats:

• Name and Surname. (for example: Zachery Barr)
• Name Initial Surname. (Stewart H. Shepherd)
• Two Names and a Surname (José Manuel Alarcón)
• Two Names and several Surnames (José Manuel Alarcón Aguín)

Download Name and LastName Splitter.xls (54 KB)

In order to use it you must enable the support for macros everytime you open it in Excel:

Press "Options", and select the "Enable this content" option:

Now just copy and paste your mixed data in any column in any sheet of this spreadsheet.

It's important that you select the range of cells you need to be processed for splitting. If you don't make any selection only the current cell will be processed.

Now go to the "View" ribbon in Excel 2007 (or Tools·Macros in previous versions) and press the "Macros" button or press ALT+F8, as it's shown below:

In the dialog that appears execute the macro "SplitCurrentColumn":

Now you will get another sheet named "Split" with two columns. In the first one you'll have the names and in the second the Lastnames.

You can process as many data columns as you want but take into account that the "Split" sheet will be emptied each time you execute the macro, so save your new data first. You cannot process data in the "Split" sheet which holds the results.

In the download I've included a sheet with sample data for you to try (300 randomly generated names).

Hope this helps!

By: José Manuel Alarcón Aguín | Tuesday, January 29, 2008 10:50:19 PM (Hora estándar romance, UTC+01:00)  #    Comments [2] - Trackback
Tags: Database marketing | TIPS
mailcast
Wednesday, February 20, 2008 12:17:29 PM (Hora estándar romance, UTC+01:00)
Hola,
Lo he estado probando pero para nombres compuestos no funciona , separa el segundo nombre como si fuera un apellido, aunque sería lo lógico teniendo en cuenta q no se puede saber si es un nombre o un apellido, solo en el caso como pones en primer lugar si es la inicial separada por un punto.
David
Wednesday, February 20, 2008 12:29:40 PM (Hora estándar romance, UTC+01:00)
Hola David:

Es que, bueno, no es infalible, pero trata de hacerlo lo mejor posible teniendo en cuanta que no usa una base de datos por debajo sino que trata de deducirlo a partir de cómo está formado el nombre, como tú bien dices. Trataré de evolucionarlo con el tiempo si se tercia :-)

Por cierto, tienes todos los post en castellano en la versión en este idioma del blog. en concreto este post en castellano lo tienes
aquí.

Saludos

JM.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, b, i, strike, strong, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
You can access this blog from your mobile phone or PDA

Sign In

Send mail to the author(s) Contacto
© 2008, (c) krasis Consulting S.L.