Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 159
Default Find And Display Surname

I'm sure there's an easy way to do this, but I can't find it! I've
got names in cells like this: MRS EDNA JOAN PASCOE (could be any
number of first and middle names). In other corresponding cells I
want to display only the surname.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Find And Display Surname

On Sat, 24 May 2008 12:03:23 -0700 (PDT), robzrob wrote:

I'm sure there's an easy way to do this, but I can't find it! I've
got names in cells like this: MRS EDNA JOAN PASCOE (could be any
number of first and middle names). In other corresponding cells I
want to display only the surname.


This formula will return the last word in a string:

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

--ron
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 159
Default Find And Display Surname

On May 24, 8:40*pm, Ron Rosenfeld wrote:
On Sat, 24 May 2008 12:03:23 -0700 (PDT), robzrob wrote:
I'm sure there's an easy way to do this, but I can't find it! *I've
got names in cells like this: *MRS EDNA JOAN PASCOE (could be any
number of first and middle names). *In other corresponding cells I
want to display only the surname.


This formula will return the last word in a string:

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

--ron


Excellent, Ron, thank you.
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Find And Display Surname

I'm sure there's an easy way to do this, but I can't find it! I've
got names in cells like this: MRS EDNA JOAN PASCOE (could be any
number of first and middle names). In other corresponding cells I
want to display only the surname.


This formula will return the last word in a string:

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


For those who might be interested, below is a shorter array-entered**
formula that does the same thing. It uses less function calls and does not
produce an error when the referenced cell is empty.

=MID(A1,MAX((MID(A1,ROW(1:255),1)=" ")*ROW(1:255))+1,255)

** For the archives: Use Ctrl+Shift+Enter to commit this formula, not Enter
by itself.

Rick



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Find And Display Surname

On Sun, 25 May 2008 15:10:29 -0400, "Rick Rothstein \(MVP - VB\)"
wrote:

=MID(A1,MAX((MID(A1,ROW(1:255),1)=" ")*ROW(1:255))+1,255)


If you make the ROW references absolute, then you'll be able to copy the
formula by dragging:

=MID(A1,MAX((MID(A1,ROW($1:$255),1)=" ")*ROW($1:$255))+1,255)

--ron


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,572
Default Find And Display Surname

And an even *shorter, non-array* approach:

=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))

--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Rick Rothstein (MVP - VB)" wrote in
message ...
I'm sure there's an easy way to do this, but I can't find it! I've
got names in cells like this: MRS EDNA JOAN PASCOE (could be any
number of first and middle names). In other corresponding cells I
want to display only the surname.


This formula will return the last word in a string:

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


For those who might be interested, below is a shorter array-entered**
formula that does the same thing. It uses less function calls and does not
produce an error when the referenced cell is empty.

=MID(A1,MAX((MID(A1,ROW(1:255),1)=" ")*ROW(1:255))+1,255)

** For the archives: Use Ctrl+Shift+Enter to commit this formula, not

Enter
by itself.

Rick




  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Find And Display Surname

=MID(A1,MAX((MID(A1,ROW(1:255),1)=" ")*ROW(1:255))+1,255)

If you make the ROW references absolute, then you'll be able to copy the
formula by dragging:

=MID(A1,MAX((MID(A1,ROW($1:$255),1)=" ")*ROW($1:$255))+1,255)


Good point.

Rick
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Find And Display Surname

I like it! One function call less than mine and it still doesn't error out
if the reference cell is empty. Of course, if the last word is longer than
99 characters...<g

Rick


"Ragdyer" wrote in message
...
And an even *shorter, non-array* approach:

=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))

--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Rick Rothstein (MVP - VB)" wrote in
message ...
I'm sure there's an easy way to do this, but I can't find it! I've
got names in cells like this: MRS EDNA JOAN PASCOE (could be any
number of first and middle names). In other corresponding cells I
want to display only the surname.

This formula will return the last word in a string:

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


For those who might be interested, below is a shorter array-entered**
formula that does the same thing. It uses less function calls and does
not
produce an error when the referenced cell is empty.

=MID(A1,MAX((MID(A1,ROW(1:255),1)=" ")*ROW(1:255))+1,255)

** For the archives: Use Ctrl+Shift+Enter to commit this formula, not

Enter
by itself.

Rick





  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,572
Default Find And Display Surname

I liked it too, the first time I saw it.

Wish I could remember who to credit it to.
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Rick Rothstein (MVP - VB)" wrote in
message ...
I like it! One function call less than mine and it still doesn't error out
if the reference cell is empty. Of course, if the last word is longer than
99 characters...<g

Rick


"Ragdyer" wrote in message
...
And an even *shorter, non-array* approach:

=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))

--
Regards,

RD


--------------------------------------------------------------------------

-
Please keep all correspondence within the NewsGroup, so all may benefit

!

--------------------------------------------------------------------------

-
"Rick Rothstein (MVP - VB)" wrote

in
message ...
I'm sure there's an easy way to do this, but I can't find it! I've
got names in cells like this: MRS EDNA JOAN PASCOE (could be any
number of first and middle names). In other corresponding cells I
want to display only the surname.

This formula will return the last word in a string:

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

For those who might be interested, below is a shorter array-entered**
formula that does the same thing. It uses less function calls and does
not
produce an error when the referenced cell is empty.

=MID(A1,MAX((MID(A1,ROW(1:255),1)=" ")*ROW(1:255))+1,255)

** For the archives: Use Ctrl+Shift+Enter to commit this formula, not

Enter
by itself.

Rick






  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 159
Default Find And Display Surname

On May 26, 4:45*pm, "Ragdyer" wrote:
I liked it too, the first time I saw it.

Wish I could remember who to credit it to.
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"Rick Rothstein (MVP - VB)" wrote in
. ..



I like it! One function call less than mine and it still doesn't error out
if the reference cell is empty. Of course, if the last word is longer than
99 characters...<g


Rick


"Ragdyer" wrote in message
...
And an even *shorter, non-array* approach:


=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))


--
Regards,


RD


--------------------------------------------------------------------------

-
Please keep all correspondence within the NewsGroup, so all may benefit

!

--------------------------------------------------------------------------

-
"Rick Rothstein (MVP - VB)" wrote

in
. ..
I'm sure there's an easy way to do this, but I can't find it! *I've
got names in cells like this: *MRS EDNA JOAN PASCOE (could be any
number of first and middle names). *In other corresponding cells I
want to display only the surname.


This formula will return the last word in a string:


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


For those who might be interested, below is a shorter array-entered**
formula that does the same thing. It uses less function calls and does
not
produce an error when the referenced cell is empty.


=MID(A1,MAX((MID(A1,ROW(1:255),1)=" ")*ROW(1:255))+1,255)


** For the archives: Use Ctrl+Shift+Enter to commit this formula, not
Enter
by itself.


Rick- Hide quoted text -


- Show quoted text -


Thanks all.
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
Change around surname and name kassie Excel Discussion (Misc queries) 8 June 10th 07 07:01 AM
Extract given and surname a string Bob Maloney Excel Worksheet Functions 3 April 29th 07 03:27 AM
Surname and First names formula Steved Excel Worksheet Functions 8 August 7th 06 07:20 AM
Splitting firstName from Surname Althea Excel Worksheet Functions 5 April 23rd 06 09:05 PM
Display only surname Pat Excel Worksheet Functions 2 June 23rd 05 10:30 PM


All times are GMT +1. The time now is 03:20 AM.

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"