A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Separating text



 
 
Thread Tools Display Modes
  #1  
Old December 10th, 2006, 06:11 PM posted to microsoft.public.excel.misc
Francis Hookham
external usenet poster
 
Posts: 54
Default Separating text

I need to separate a long list of names into First and Surname.

The trouble is I do not know how to use FIND to find the last space in the
text string. Can you help?

(I see I shall have to use Replace to get rid of White Space first.)



Rev and Mrs R Grosse

Helen & John Hadland

John and Valerie Hall

Peter and Pat Hall

Peter and Linda Halton



Francis Hookham (That's me!)


  #2  
Old December 10th, 2006, 07:21 PM posted to microsoft.public.excel.misc
Teethless mama
external usenet poster
 
Posts: 3,722
Default Separating text

Get the first name:
=LEFT(A1,FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))-1)

Get the last name:
=RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1,"
","")))))


"Francis Hookham" wrote:

I need to separate a long list of names into First and Surname.

The trouble is I do not know how to use FIND to find the last space in the
text string. Can you help?

(I see I shall have to use Replace to get rid of White Space first.)



Rev and Mrs R Grosse

Helen & John Hadland

John and Valerie Hall

Peter and Pat Hall

Peter and Linda Halton



Francis Hookham (That's me!)



  #3  
Old December 10th, 2006, 08:35 PM posted to microsoft.public.excel.misc
RichardSchollar
external usenet poster
 
Posts: 139
Default Separating text

Hi Francis

If Trailing/Leading spaces might be an issue, you could use this
adaptation:

First name(s)

=LEFT(TRIM(A1),FIND("@",SUBSTITUTE(TRIM(A1),"
","@",LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ","")))))

Surname

=TRIM(REPLACE(TRIM(A1),1,LEN(B1),""))

Hope this helps!

Richard





Francis Hookham wrote:
I need to separate a long list of names into First and Surname.

The trouble is I do not know how to use FIND to find the last space in the
text string. Can you help?

(I see I shall have to use Replace to get rid of White Space first.)



Rev and Mrs R Grosse

Helen & John Hadland

John and Valerie Hall

Peter and Pat Hall

Peter and Linda Halton



Francis Hookham (That's me!)


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.