Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,670
Default Find last name in multi-part name?

I have a list of people's names. Each name consists of 2-6 individual names,
in order FIRSTNAME MIDDLENAME LASTNAME format, separated by spaces. These
are lists of staff in India, and in some cases there are multiple middle
names: FIRSTNAME MIDDLENAME1 MIDDLENAME2 MIDDLENAME3 LASTNAME.

I need to take apart the names so that I have the last name in one column
and the first name + middle names (if any) in another column.

I'm hoping to find a couple of formulas that would do this.

Alternatively, I could use "convert text to columns", but since the names
have different lengths, I wouldn't always end up with the last name in the
same column. Is there some way to identify the last non-blank cell in a
range?

Suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Find last name in multi-part name?

One way:

First name:

=LEFT(A1,FIND(" ",A1)-1)

Last name:

=MID(A1,FIND("$",SUBSTITUTE(A1," ","$",LEN(A1)-LEN(SUBSTITUTE(A1," ",
""))))+1,255)

the latter assumes that there are no last names like "Van Dyke"


In article ,
Eric wrote:

I have a list of people's names. Each name consists of 2-6 individual names,
in order FIRSTNAME MIDDLENAME LASTNAME format, separated by spaces. These
are lists of staff in India, and in some cases there are multiple middle
names: FIRSTNAME MIDDLENAME1 MIDDLENAME2 MIDDLENAME3 LASTNAME.

I need to take apart the names so that I have the last name in one column
and the first name + middle names (if any) in another column.

I'm hoping to find a couple of formulas that would do this.

Alternatively, I could use "convert text to columns", but since the names
have different lengths, I wouldn't always end up with the last name in the
same column. Is there some way to identify the last non-blank cell in a
range?

Suggestions?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,670
Default Find last name in multi-part name?

JE -

I've spent half an hour trying to figure this out why this works, and
haven't yet managed.... but I will !

In the meantime, I tried it and it worked fine... except on one name, which
I discovered had a couple of extra blanks on the right. So I'll modify the
formula to TRIM the name before I use it, and it looks like it will work fine.

Thanks for your help!

Eric

"JE McGimpsey" wrote:

One way:

First name:

=LEFT(A1,FIND(" ",A1)-1)

Last name:

=MID(A1,FIND("$",SUBSTITUTE(A1," ","$",LEN(A1)-LEN(SUBSTITUTE(A1," ",
""))))+1,255)

the latter assumes that there are no last names like "Van Dyke"


In article ,
Eric wrote:

I have a list of people's names. Each name consists of 2-6 individual names,
in order FIRSTNAME MIDDLENAME LASTNAME format, separated by spaces. These
are lists of staff in India, and in some cases there are multiple middle
names: FIRSTNAME MIDDLENAME1 MIDDLENAME2 MIDDLENAME3 LASTNAME.

I need to take apart the names so that I have the last name in one column
and the first name + middle names (if any) in another column.

I'm hoping to find a couple of formulas that would do this.

Alternatively, I could use "convert text to columns", but since the names
have different lengths, I wouldn't always end up with the last name in the
same column. Is there some way to identify the last non-blank cell in a
range?

Suggestions?


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 21
Default Find last name in multi-part name?

I see here that you need to separate the name by the spaces in between the
words, for that you may want to use a consecutive series of formulas that
count and tells you the position of the " " in a desired cell e.g. "A1"
unveiling the relative position of it..

This is:
=IF(ISERROR(FIND(" ",$A1,FIND(" ",$A1,FIND(" ",$A1,FIND(" ",$A1,FIND("
",$A1)+1)+1)+1)+1)),FIND(" ",$A1,FIND(" ",$A1,FIND(" ",$A1,FIND("
",$A1)+1)+1)+1),IF(ISERROR(FIND(" ",$A1,FIND(" ",$A1,FIND(" ",$A1,FIND("
",$A1)+1)+1)+1)),FIND(" ",$A1,(FIND(" ",$A1,FIND("
",$A1))+1)+1),IF(ISERROR(FIND(" ",$A1,FIND(" ",$A1)+1)),FIND(" ",$A1))))

the previous paragraph evaluates for five words separated by spaces where
you can't find the " " character and returns the last know position of the "
", on the EG that you provided: "FIRSTNAME MIDDLENAME1 MIDDLENAME2
MIDDLENAME3 LASTNAME" is the # 46.

After that, request the difference of "right" side of that position with the
total length of the text inside the cell and this will return the last word,
assuming that is the "lastname" and not a two or more words composed last
name:

=RIGHT(A1,LEN(A1)-((IF(ISERROR(FIND(" ",$A1,FIND(" ",$A1,FIND(" ",$A1,FIND("
",$A1,FIND(" ",$A1)+1)+1)+1)+1)),FIND(" ",$A1,FIND(" ",$A1,FIND("
",$A1,FIND(" ",$A1)+1)+1)+1),IF(ISERROR(FIND(" ",$A1,FIND(" ",$A1,FIND("
",$A1,FIND(" ",$A1)+1)+1)+1)),FIND(" ",$A1,(FIND(" ",$A1,FIND("
",$A1))+1)+1),IF(ISERROR(FIND(" ",$A1,FIND(" ",$A1)+1)),FIND(" ",$A1)))))))

Some people will find easy solutions, in the meantime try to copy and paste
the above formula.

Respectfully,

Leo Rod.

"Eric" wrote in message
...
I have a list of people's names. Each name consists of 2-6 individual
names,
in order FIRSTNAME MIDDLENAME LASTNAME format, separated by spaces. These
are lists of staff in India, and in some cases there are multiple middle
names: FIRSTNAME MIDDLENAME1 MIDDLENAME2 MIDDLENAME3 LASTNAME.

I need to take apart the names so that I have the last name in one column
and the first name + middle names (if any) in another column.

I'm hoping to find a couple of formulas that would do this.

Alternatively, I could use "convert text to columns", but since the names
have different lengths, I wouldn't always end up with the last name in the
same column. Is there some way to identify the last non-blank cell in a
range?

Suggestions?



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Find last name in multi-part name?

On Thu, 1 Nov 2007 08:45:05 -0700, Eric wrote:

I have a list of people's names. Each name consists of 2-6 individual names,
in order FIRSTNAME MIDDLENAME LASTNAME format, separated by spaces. These
are lists of staff in India, and in some cases there are multiple middle
names: FIRSTNAME MIDDLENAME1 MIDDLENAME2 MIDDLENAME3 LASTNAME.

I need to take apart the names so that I have the last name in one column
and the first name + middle names (if any) in another column.

I'm hoping to find a couple of formulas that would do this.

Alternatively, I could use "convert text to columns", but since the names
have different lengths, I wouldn't always end up with the last name in the
same column. Is there some way to identify the last non-blank cell in a
range?

Suggestions?


LASTNAME:

=MID(SUBSTITUTE(A1," ",CHAR(1),LEN(A1)-LEN(SUBSTITUTE(A1," ",""))),
FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)-LEN(
SUBSTITUTE(A1," ",""))))+1,255)

First Name + All Middle Names:

=LEFT(A1,FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),
LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-1)
--ron


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
How do I use VLOOKUP to find part of string? niatpac Excel Worksheet Functions 3 July 19th 07 07:43 PM
Find Common names in multi ranges JG Excel Worksheet Functions 4 December 23rd 06 04:28 AM
Find part data in row range? Fluke Excel Worksheet Functions 1 September 11th 06 11:31 PM
Find part of a word in cell Elaine Excel Discussion (Misc queries) 7 March 3rd 06 07:37 PM
Find and copy part of a cell Srwe Excel Worksheet Functions 2 November 16th 05 11:46 AM


All times are GMT +1. The time now is 07:03 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"