Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Extract surname from forenames

Hello,

I have a long list of names that I want to break down into
Surname/Forenames. I have used an IF statement to get out the surname after
using Text to Cols to breakdown the data. I now need to separate out all
other names - any idea how to do this?
Some sample data:

Surname Forenames
AGNEW ROBERT E AGNEW
HYDE W H S HYDE
KEYS RICHARD KEYS
LYONS WILLIAM JOHN LYONS
PRICE HAROLD PRICE
BOYD SUSAN ELIZABETH ANN BOYD

Thanks,

Charlotte

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Extract surname from forenames

Try this:
Select column containing whole names
DataText to columnschoose Separated optionNextCheck Spaces as separator

(provided all name element are separated by spaces as shown in your example)

Regards,
Stefi

€˛Charlotte Howard€¯ ezt Ć*rta:

Hello,

I have a long list of names that I want to break down into
Surname/Forenames. I have used an IF statement to get out the surname after
using Text to Cols to breakdown the data. I now need to separate out all
other names - any idea how to do this?
Some sample data:

Surname Forenames
AGNEW ROBERT E AGNEW
HYDE W H S HYDE
KEYS RICHARD KEYS
LYONS WILLIAM JOHN LYONS
PRICE HAROLD PRICE
BOYD SUSAN ELIZABETH ANN BOYD

Thanks,

Charlotte

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Extract surname from forenames

Hi Stefi,

Text-to-Columns will not work in this instance. Some people only have 1
forename, others have 4 (see below for result of using text to cols).
Largely they only have 1 surname, so I managed to extract that using
=IF(O3<0,O3,IF(N3<0,N3,IF(M3<0,M3,IF(L3<0,L3,I F(K3<0,K3,IF(J3<0,J3,IF(I3<0,I3,"false")))))))

I now need to get all the forenames in one column.

ROBERT E AGNEW
W H S HYDE
RICHARD KEYS
CHARLES KNIPE
WILLIAM JOHN LYONS
HAROLD PRICE
SUSAN ELIZABETH ANN BOYD

Thanks!
Charlotte

"Stefi" wrote:

Try this:
Select column containing whole names
DataText to columnschoose Separated optionNextCheck Spaces as separator

(provided all name element are separated by spaces as shown in your example)

Regards,
Stefi

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Extract surname from forenames

If you use Data | Text-to-columns on your sample data using space as
delimiter, then clearly you will get some surnames in the second,
third or fourth columns beyond your first name (assume this to be in
A1). You could put a formula like this in a helper column to get the
surname:

=IF(E1<"",E1,IF(D1<"",D1,IF(C1<"",C1,B1)))

and copy this down. This will cope with up to 5 names and/or initials
and will always return the final name in the cells B to E, assuming
column A is a forename.

Hope this helps.

Pete


On Mar 20, 1:36*pm, Charlotte Howard
wrote:
Hello,

I have a long list of names that I want to break down into
Surname/Forenames. *I have used an IF statement to get out the surname after
using Text to Cols to breakdown the data. *I now need to separate out all
other names - any idea how to do this?
Some sample data:

Surname Forenames
AGNEW * ROBERT E AGNEW
HYDE * *W H S HYDE
KEYS * *RICHARD KEYS
LYONS * WILLIAM JOHN LYONS
PRICE * HAROLD PRICE
BOYD * *SUSAN ELIZABETH ANN BOYD

Thanks,

Charlotte


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Extract surname from forenames

Hi Pete,
I used a similar IF statement to extract the surnames, but I now need to get
the forenames into a column on their own.
I have a Column called Surname with the surname, and one called name with
the entire name - fore & surnames - I have also used Text to Cols with the
space delimiter to separate out all names.

I need to be able to keep all forenames (some people have as many as four)
in a column together.

Thanks for your help

Charlotte

"Pete_UK" wrote:

If you use Data | Text-to-columns on your sample data using space as
delimiter, then clearly you will get some surnames in the second,
third or fourth columns beyond your first name (assume this to be in
A1). You could put a formula like this in a helper column to get the
surname:

=IF(E1<"",E1,IF(D1<"",D1,IF(C1<"",C1,B1)))

and copy this down. This will cope with up to 5 names and/or initials
and will always return the final name in the cells B to E, assuming
column A is a forename.

Hope this helps.

Pete




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Extract surname from forenames

Assume your surnames are in column A and entire names are in column B
as shown in your example. Put this formula in C1:

=LEFT(B1,LEN(B1)-LEN(A1)-1)

If you might have leading/trailing or multiple spaces, then you can
wrap TRIM( ... ) around the references to A1 and B1. Then you can copy
the formula down.

Another way would have been to use the SUBSTITUTE function.

Hope this helps.

Pete

On Mar 20, 3:43*pm, Charlotte Howard
wrote:
Hi Pete,
I used a similar IF statement to extract the surnames, but I now need to get
the forenames into a column on their own. *
I have a Column called Surname with the surname, and one called name with
the entire name - fore & surnames - I have also used Text to Cols with the
space delimiter to separate out all names.

I need to be able to keep all forenames (some people have as many as four)
in a column together.

Thanks for your help

Charlotte



"Pete_UK" wrote:
If you use Data | Text-to-columns on your sample data using space as
delimiter, then clearly you will get some surnames in the second,
third or fourth columns beyond your first name (assume this to be in
A1). You could put a formula like this in a helper column to get the
surname:


=IF(E1<"",E1,IF(D1<"",D1,IF(C1<"",C1,B1)))


and copy this down. This will cope with up to 5 names and/or initials
and will always return the final name in the cells B to E, assuming
column A is a forename.


Hope this helps.


Pete- Hide quoted text -


- Show quoted text -


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Extract surname from forenames

Brilliant Pete - here I was trying IF statements - and all I needed was
either Substitute or Left!

Thanks a mill

Charlotte

"Pete_UK" wrote:

Assume your surnames are in column A and entire names are in column B
as shown in your example. Put this formula in C1:

=LEFT(B1,LEN(B1)-LEN(A1)-1)

If you might have leading/trailing or multiple spaces, then you can
wrap TRIM( ... ) around the references to A1 and B1. Then you can copy
the formula down.

Another way would have been to use the SUBSTITUTE function.

Hope this helps.

Pete

On Mar 20, 3:43 pm, Charlotte Howard
wrote:
Hi Pete,
I used a similar IF statement to extract the surnames, but I now need to get
the forenames into a column on their own.
I have a Column called Surname with the surname, and one called name with
the entire name - fore & surnames - I have also used Text to Cols with the
space delimiter to separate out all names.

I need to be able to keep all forenames (some people have as many as four)
in a column together.

Thanks for your help

Charlotte



"Pete_UK" wrote:
If you use Data | Text-to-columns on your sample data using space as
delimiter, then clearly you will get some surnames in the second,
third or fourth columns beyond your first name (assume this to be in
A1). You could put a formula like this in a helper column to get the
surname:


=IF(E1<"",E1,IF(D1<"",D1,IF(C1<"",C1,B1)))


and copy this down. This will cope with up to 5 names and/or initials
and will always return the final name in the cells B to E, assuming
column A is a forename.


Hope this helps.


Pete- Hide quoted text -


- Show quoted text -



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,856
Default Extract surname from forenames

You're welcome, Charlotte - thanks for feeding back.

Pete

On Mar 20, 4:11*pm, Charlotte Howard
wrote:
Brilliant Pete - here I was trying IF statements - and all I needed was
either Substitute or Left!

Thanks a mill

Charlotte



"Pete_UK" wrote:
Assume your surnames are in column A and entire names are in column B
as shown in your example. Put this formula in C1:


=LEFT(B1,LEN(B1)-LEN(A1)-1)


If you might have leading/trailing or multiple spaces, then you can
wrap TRIM( ... ) around the references to A1 and B1. Then you can copy
the formula down.


Another way would have been to use the SUBSTITUTE function.


Hope this helps.


Pete


On Mar 20, 3:43 pm, Charlotte Howard
wrote:
Hi Pete,
I used a similar IF statement to extract the surnames, but I now need to get
the forenames into a column on their own. *
I have a Column called Surname with the surname, and one called name with
the entire name - fore & surnames - I have also used Text to Cols with the
space delimiter to separate out all names.


I need to be able to keep all forenames (some people have as many as four)
in a column together.


Thanks for your help


Charlotte


"Pete_UK" wrote:
If you use Data | Text-to-columns on your sample data using space as
delimiter, then clearly you will get some surnames in the second,
third or fourth columns beyond your first name (assume this to be in
A1). You could put a formula like this in a helper column to get the
surname:


=IF(E1<"",E1,IF(D1<"",D1,IF(C1<"",C1,B1)))


and copy this down. This will cope with up to 5 names and/or initials
and will always return the final name in the cells B to E, assuming
column A is a forename.


Hope this helps.


Pete- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


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
Split surname from end of name data Serena Excel Worksheet Functions 4 October 10th 07 11:18 PM
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
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 09:27 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"