#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 125
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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,718
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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 196
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!)


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
Separating Text in Excel Dave F Excel Discussion (Misc queries) 0 November 30th 06 03:54 PM
Separating Text in Excel Excel Help Needed Excel Discussion (Misc queries) 0 November 30th 06 03:46 PM
Separating text Natalie Excel Worksheet Functions 1 April 5th 05 12:02 PM
Separating text PDJ Excel Worksheet Functions 1 January 18th 05 11:34 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


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