Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
NewKid
 
Posts: n/a
Default Text to Columns - Only want to split SPECIFIC NUMBER of times

I am trying to split names across columns. The problem is that some names
spilt into 3 columns (first, middle, last), and others split across 5 or 6
(extra names, etc.)

Is there a way to specify split, using SPACE as a delimiter, but only split
on the first TWO spaces, then leave the rest alone?

I'm having a terrible time figuring this out. Any ideas anyone?

Thank you so much!

Mary
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Govind
 
Posts: n/a
Default Text to Columns - Only want to split SPECIFIC NUMBER of times

Hi,

Try using

=MID(A1,1,FIND(",",A1)-1)&" "&MID(A1,FIND("
",A1)+1,(FIND("!",SUBSTITUTE(A1,",","!",2))-FIND(" ",A1)-1))

where the names are in A1. This would give the 'firstname last name'
format in one single cell.

Another alternative is to use SPACE as delimiter, but select the rest of
the names and choose 'DO NOT IMPORT' in the Text to columns window.

Regards

Govind.

NewKid wrote:
I am trying to split names across columns. The problem is that some names
spilt into 3 columns (first, middle, last), and others split across 5 or 6
(extra names, etc.)

Is there a way to specify split, using SPACE as a delimiter, but only split
on the first TWO spaces, then leave the rest alone?

I'm having a terrible time figuring this out. Any ideas anyone?

Thank you so much!

Mary

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ashish Mathur
 
Posts: n/a
Default Text to Columns - Only want to split SPECIFIC NUMBER of times

Hi,

You may want to try the following array formula (Ctrl+Shift+Enter)

Assuming the name in cell A32, enter the following array formulas

In cell B32 (to get first name)

=MID(A32,MATCH(TRUE,EXACT(MID(A32,ROW($1:$40),1),P ROPER(MID(A32,ROW($1:$40),1))),0),MATCH(TRUE,EXACT (MID(A32,ROW($2:$40),1),PROPER(MID(A32,ROW($2:$40) ,1))),0))

In cell C32 (to get middle name)

=IF(ISERROR(MID(A32,SEARCH(" ",A32,1)+1,SEARCH("
",A32,MATCH(32,CODE(MID(A32,ROW($1:$40),1)),0) +1)-SEARCH(" ",A32,1))),"
",MID(A32,SEARCH(" ",A32,1)+1,SEARCH("
",A32,MATCH(32,CODE(MID(A32,ROW($1:$40),1)),0) +1)-SEARCH(" ",A32,1)))

In cell D32, to get anything after that

=IF(ISERROR(MID(A32,SEARCH("
",A32,MATCH(32,CODE(MID(A32,ROW($1:$40),1)),0)+1)+ 1,255)),MID(A32,MATCH(TRUE,EXACT(MID(A32,ROW($2:$4 0),1),PROPER(MID(A32,ROW($2:$40),1))),0)+2,255),MI D(A32,SEARCH(" ",A32,MATCH(32,CODE(MID(A32,ROW($1:$40),1)),0)+1)+ 1,255))

Regards,

Ashish Mathur



"NewKid" wrote:

I am trying to split names across columns. The problem is that some names
spilt into 3 columns (first, middle, last), and others split across 5 or 6
(extra names, etc.)

Is there a way to specify split, using SPACE as a delimiter, but only split
on the first TWO spaces, then leave the rest alone?

I'm having a terrible time figuring this out. Any ideas anyone?

Thank you so much!

Mary

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
NewKid
 
Posts: n/a
Default Text to Columns - Only want to split SPECIFIC NUMBER of times

Thank you. I've tried this, but still having some difficulty. As an example,
If my names are in one cell, such as this:

PATRICE D ALSTON
KIM SCHULTS
MARCY CERVENANSKY
QUINCEY WILSON
RICARDO L DE LA ROSA JR
SABRINA A WATSON SR
MILLISA N AZILLE
FABIOLA M OCHOA
TOI FIELDS
GREGORY MEJIA

And I want to split them up into columns using a SPACE as the delimiter,
BUT, I really only want the first name in a column, the middle name as a
column, and then all the rest as a column. I realize that I may still have
some manual cleanup to do, but on a large set of data, it would be helpful to
split them up like this.

When I tried your suggestion, I got this:

PATRICE D ALSTON P #VALUE! ALSTON
KIM SCHULTS K M SCHULTS
MARCY CERVENANSKY M RCY CERVENANSKY
QUINCEY WILSON Q INCEY WILSON
RICARDO L DE LA ROSA JR R #VALUE! DE LA ROSA JR
SABRINA A WATSON SR S #VALUE! A WATSON SR
MILLISA N AZILLE M #VALUE! AZILLE
FABIOLA M OCHOA F #VALUE! OCHOA
TOI FIELDS T I FIELDS

Any other ideas? Thanks so much.

NewKid


"Ashish Mathur" wrote:

Hi,

You may want to try the following array formula (Ctrl+Shift+Enter)

Assuming the name in cell A32, enter the following array formulas

In cell B32 (to get first name)

=MID(A32,MATCH(TRUE,EXACT(MID(A32,ROW($1:$40),1),P ROPER(MID(A32,ROW($1:$40),1))),0),MATCH(TRUE,EXACT (MID(A32,ROW($2:$40),1),PROPER(MID(A32,ROW($2:$40) ,1))),0))

In cell C32 (to get middle name)

=IF(ISERROR(MID(A32,SEARCH(" ",A32,1)+1,SEARCH("
",A32,MATCH(32,CODE(MID(A32,ROW($1:$40),1)),0) +1)-SEARCH(" ",A32,1))),"
",MID(A32,SEARCH(" ",A32,1)+1,SEARCH("
",A32,MATCH(32,CODE(MID(A32,ROW($1:$40),1)),0) +1)-SEARCH(" ",A32,1)))

In cell D32, to get anything after that

=IF(ISERROR(MID(A32,SEARCH("
",A32,MATCH(32,CODE(MID(A32,ROW($1:$40),1)),0)+1)+ 1,255)),MID(A32,MATCH(TRUE,EXACT(MID(A32,ROW($2:$4 0),1),PROPER(MID(A32,ROW($2:$40),1))),0)+2,255),MI D(A32,SEARCH(" ",A32,MATCH(32,CODE(MID(A32,ROW($1:$40),1)),0)+1)+ 1,255))

Regards,

Ashish Mathur



"NewKid" wrote:

I am trying to split names across columns. The problem is that some names
spilt into 3 columns (first, middle, last), and others split across 5 or 6
(extra names, etc.)

Is there a way to specify split, using SPACE as a delimiter, but only split
on the first TWO spaces, then leave the rest alone?

I'm having a terrible time figuring this out. Any ideas anyone?

Thank you so much!

Mary

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default Text to Columns - Only want to split SPECIFIC NUMBER of times

On Thu, 26 Jan 2006 15:22:02 -0800, NewKid
wrote:

I am trying to split names across columns. The problem is that some names
spilt into 3 columns (first, middle, last), and others split across 5 or 6
(extra names, etc.)

Is there a way to specify split, using SPACE as a delimiter, but only split
on the first TWO spaces, then leave the rest alone?

I'm having a terrible time figuring this out. Any ideas anyone?

Thank you so much!

Mary


1. Download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/

Then use these formulas:

Assume Name String is in A1:

B1: =REGEX.MID($A1,"\w+",1)
C1: =REGEX.MID($A1,"\w+",2)
D1: =REGEX.SUBSTITUTE(TRIM(A1),"^\w+(\s|$)(\w+(\s|$))? ")

These are "regular expressions"

B1: Get first word
C1: Get 2nd word
D1: Removes 1st and (if present) 2nd words; so returns the rest
--ron


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
NewKid
 
Posts: n/a
Default Text to Columns - Only want to split SPECIFIC NUMBER of times

Hello Ron,
Thank you for your help. The "morefunc.xll" functions are very useful. I
appreciate this. Thanks again.
Mary



"Ron Rosenfeld" wrote:

On Thu, 26 Jan 2006 15:22:02 -0800, NewKid
wrote:

I am trying to split names across columns. The problem is that some names
spilt into 3 columns (first, middle, last), and others split across 5 or 6
(extra names, etc.)

Is there a way to specify split, using SPACE as a delimiter, but only split
on the first TWO spaces, then leave the rest alone?

I'm having a terrible time figuring this out. Any ideas anyone?

Thank you so much!

Mary


1. Download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/

Then use these formulas:

Assume Name String is in A1:

B1: =REGEX.MID($A1,"\w+",1)
C1: =REGEX.MID($A1,"\w+",2)
D1: =REGEX.SUBSTITUTE(TRIM(A1),"^\w+(\s|$)(\w+(\s|$))? ")

These are "regular expressions"

B1: Get first word
C1: Get 2nd word
D1: Removes 1st and (if present) 2nd words; so returns the rest
--ron

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default Text to Columns - Only want to split SPECIFIC NUMBER of times

On Mon, 30 Jan 2006 10:57:28 -0800, NewKid
wrote:

Hello Ron,
Thank you for your help. The "morefunc.xll" functions are very useful. I
appreciate this. Thanks again.
Mary




Glad to help. And yes, Laurent has a lot of good stuff in that add-in.


--ron
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default Text to Columns - Only want to split SPECIFIC NUMBER of times

On Mon, 30 Jan 2006 10:57:28 -0800, NewKid
wrote:

Hello Ron,
Thank you for your help. The "morefunc.xll" functions are very useful. I
appreciate this. Thanks again.
Mary


Mary,

Thinking about possibilities, the expression I gave you (for the third column)
has a problem if anything in the first two words contains a dot (e.g. Millisa
N. Azille). So this will correct that oversight:

=REGEX.SUBSTITUTE(TRIM($A1),"^(\w+\.?(\s|$)){1,2}" )


--ron
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
NewKid
 
Posts: n/a
Default Text to Columns - Only want to split SPECIFIC NUMBER of times

You are wonderful. Thanks!!!!

"Ron Rosenfeld" wrote:

On Mon, 30 Jan 2006 10:57:28 -0800, NewKid
wrote:

Hello Ron,
Thank you for your help. The "morefunc.xll" functions are very useful. I
appreciate this. Thanks again.
Mary


Mary,

Thinking about possibilities, the expression I gave you (for the third column)
has a problem if anything in the first two words contains a dot (e.g. Millisa
N. Azille). So this will correct that oversight:

=REGEX.SUBSTITUTE(TRIM($A1),"^(\w+\.?(\s|$)){1,2}" )


--ron

  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Guy Yeakley
 
Posts: n/a
Default Text to Columns - Only want to split SPECIFIC NUMBER of times

It looks like you have an Excel answer on this, but I do a workaround. I copy
the columns I want to split out to Word, convert the table to text, then
replace spaces with tabs. Finally, I convert the resulting text back to
table, copy, and paste back in Excel.
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
TEXT TO COLUMNS WITH LEADING ZEROS Peggy Excel Discussion (Misc queries) 6 April 27th 23 03:45 AM
How do I look up a number within a string of text Rich Hayes Excel Worksheet Functions 3 October 14th 05 05:49 PM
Text to Columns from drop down list update Kurgan Excel Discussion (Misc queries) 0 June 21st 05 12:14 PM
Convert specific text to a corresponding number slh Excel Discussion (Misc queries) 7 May 18th 05 10:47 AM
Sort or Filter option? Mcobra41 Excel Worksheet Functions 3 February 23rd 05 07:22 PM


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