LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Tue, 31 May 2005 18:30:01 -0700, Shadowofthedarkgod
wrote:


I have the following input:

First name: John Michael or John
MI: C
Last name: Dela Toya or Doe

Now what I need is to convert John Michael C Dela Toya to jmcdelatoya, or
John C Doe to jcdoe. I'm having trouble in making excel count the number of
words in a name, since if my input has 3 first names, it has to have 3
initials,like this: Mary Jane Carmen D. Roberts to mjcdroberts. Can anyone
help me pls? Thanks


It's relatively simple to have the initials of all the names and except spell
out the last and have it all in lower case. A short UDF:

========================
Function NameCode(Names As String) As String
Dim Nm
Dim i As Long

Nm = Split(Names)
For i = 0 To UBound(Nm) - 1
NameCode = NameCode & Left(Nm(i), 1)
Next i

NameCode = LCase(NameCode & Nm(i))

End Function
======================

However, with a name like John Dela Toya, where Dela Toya is the last name, I
know of no rule that can differentiate that from John Dela Toya, where Dela is
the middle name.

So you need to develop a method of determining when the last two names in the
string represent a last name, vs a middle and last name.




--ron
 
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



All times are GMT +1. The time now is 02:37 AM.

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"