Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Splitting text in a cell

Hello,
In Excel 2007, I have a series of cells with the names of two people in them
in the format of "Person One and Person Two". Is there any function which
could put each person's name in a different cell, by looking for the word
"and" to use to decide where to split the text?
I know that if each persons name was the same length, I could use the LEFT
and RIGHT functions, but as name lengths vary, I cannot use these functions
for this.
Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default Splitting text in a cell

They can still be used but it is better to use MID instead of RIGHT perhaps

=TRIM(LEFT(A1,SEARCH("and",A1)-1))


for first name


=TRIM(MID(A1,SEARCH("and",A1)+3,255))


for second


copy both formulas down and then copy and paste special as values in place
to make them, independent of the source string


--
Regards,

Peo Sjoblom



"Richard_123" wrote in message
...
Hello,
In Excel 2007, I have a series of cells with the names of two people in
them
in the format of "Person One and Person Two". Is there any function which
could put each person's name in a different cell, by looking for the word
"and" to use to decide where to split the text?
I know that if each persons name was the same length, I could use the LEFT
and RIGHT functions, but as name lengths vary, I cannot use these
functions
for this.
Thank you.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,081
Default Splitting text in a cell

Peo -

Probably safer to use " and " as the search string, to protect against
splitting names like Anderson or Sanderson where you don't want to.



"Peo Sjoblom" wrote:

They can still be used but it is better to use MID instead of RIGHT perhaps

=TRIM(LEFT(A1,SEARCH("and",A1)-1))


for first name


=TRIM(MID(A1,SEARCH("and",A1)+3,255))


for second


copy both formulas down and then copy and paste special as values in place
to make them, independent of the source string


--
Regards,

Peo Sjoblom



"Richard_123" wrote in message
...
Hello,
In Excel 2007, I have a series of cells with the names of two people in
them
in the format of "Person One and Person Two". Is there any function which
could put each person's name in a different cell, by looking for the word
"and" to use to decide where to split the text?
I know that if each persons name was the same length, I could use the LEFT
and RIGHT functions, but as name lengths vary, I cannot use these
functions
for this.
Thank you.




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default Splitting text in a cell

Definitely, good catch Duke

Obviously that would change the formulas a bit when it comes to the
subtract/added offsets to the search part

Peo



"Duke Carey" wrote in message
...
Peo -

Probably safer to use " and " as the search string, to protect against
splitting names like Anderson or Sanderson where you don't want to.



"Peo Sjoblom" wrote:

They can still be used but it is better to use MID instead of RIGHT
perhaps

=TRIM(LEFT(A1,SEARCH("and",A1)-1))


for first name


=TRIM(MID(A1,SEARCH("and",A1)+3,255))


for second


copy both formulas down and then copy and paste special as values in
place
to make them, independent of the source string


--
Regards,

Peo Sjoblom



"Richard_123" wrote in message
...
Hello,
In Excel 2007, I have a series of cells with the names of two people in
them
in the format of "Person One and Person Two". Is there any function
which
could put each person's name in a different cell, by looking for the
word
"and" to use to decide where to split the text?
I know that if each persons name was the same length, I could use the
LEFT
and RIGHT functions, but as name lengths vary, I cannot use these
functions
for this.
Thank you.






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Splitting text in a cell

Thanks, this was really helpful. I didn't even know there was such a function
as TRIM before! Thank you very much.

"Peo Sjoblom" wrote:

They can still be used but it is better to use MID instead of RIGHT perhaps

=TRIM(LEFT(A1,SEARCH("and",A1)-1))


for first name


=TRIM(MID(A1,SEARCH("and",A1)+3,255))


for second


copy both formulas down and then copy and paste special as values in place
to make them, independent of the source string


--
Regards,

Peo Sjoblom



"Richard_123" wrote in message
...
Hello,
In Excel 2007, I have a series of cells with the names of two people in
them
in the format of "Person One and Person Two". Is there any function which
could put each person's name in a different cell, by looking for the word
"and" to use to decide where to split the text?
I know that if each persons name was the same length, I could use the LEFT
and RIGHT functions, but as name lengths vary, I cannot use these
functions
for this.
Thank you.






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
Splitting text in a cell Richard_123 Excel Discussion (Misc queries) 4 July 26th 07 09:47 PM
Splitting Text strings in one cell Wardy1 Excel Discussion (Misc queries) 1 May 18th 06 01:05 PM
splitting text from one cell rogera Excel Discussion (Misc queries) 1 January 10th 06 01:43 PM
splitting text in a cell.. via135 Excel Discussion (Misc queries) 5 December 23rd 05 01:04 AM
Splitting Up Text in One Cell To Many Bert_Lady Excel Worksheet Functions 3 December 9th 05 01:55 AM


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