Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Conditional splitting of cells

I've run into a problem and would be really grateful for any help.

I bascially need to import data from a spreadsheet into our customer
database but I need to split the 'customer name' field into three
separate ones - Title (as applicable)/First Name/Last Name.

The problem is that there is no consistency in how this data has been
captured so some names contain their Title while others don't. I've
already found a macro that allows me to split out the last name into a
new column but I also need to identify Titles (hoping to being able to
identify Mr/Mrs/Ms/Dr) where they appear and move them as well. Can
anyone think of a macro that could do this?

Thanks again,
Peter
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Conditional splitting of cells

varr = Array("mr","mrs","ms","dr")
for i = lbound(varr) to ubound(varr)
iloc = instr(1,sCustomerName,varr(i),vbTextCompare)
if iloc < 0 then
sTitle = varr(i)
exit for
end if
Next

Would be a start. You would also want to check that you found a title and
not a substring in the name (neDReck Smith for example)

--
Regards,
Tom Ogilvy


"Peter" wrote in message
om...
I've run into a problem and would be really grateful for any help.

I bascially need to import data from a spreadsheet into our customer
database but I need to split the 'customer name' field into three
separate ones - Title (as applicable)/First Name/Last Name.

The problem is that there is no consistency in how this data has been
captured so some names contain their Title while others don't. I've
already found a macro that allows me to split out the last name into a
new column but I also need to identify Titles (hoping to being able to
identify Mr/Mrs/Ms/Dr) where they appear and move them as well. Can
anyone think of a macro that could do this?

Thanks again,
Peter



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
Splitting cells fazz Excel Discussion (Misc queries) 5 May 5th 10 01:24 PM
Splitting cells Splitting Cells Excel Discussion (Misc queries) 3 October 23rd 08 08:25 AM
splitting cells Joanne New Users to Excel 3 October 9th 07 05:03 AM
Splitting cells - please help! Danny boy Excel Worksheet Functions 11 October 31st 06 02:54 PM
Splitting Cells MFFC2005 New Users to Excel 1 August 2nd 05 05:01 PM


All times are GMT +1. The time now is 02:29 PM.

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

About Us

"It's about Microsoft Excel"