Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
genkate
 
Posts: n/a
Default TEXT INTO COLUMNS

I have a list of names; want to split into 2 columns-surnames & everything
else. format is always: john q. public/john public/j. p. public,etc. no
suffixes, nothing is after surname. All I need to do is count to the first
space from the RIGHT. Can Excel do that?

Thanks!
Kate
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default TEXT INTO COLUMNS

On Fri, 17 Feb 2006 10:23:27 -0800, "genkate"
wrote:

I have a list of names; want to split into 2 columns-surnames & everything
else. format is always: john q. public/john public/j. p. public,etc. no
suffixes, nothing is after surname. All I need to do is count to the first
space from the RIGHT. Can Excel do that?

Thanks!
Kate



If the surname is always the last word in the cell, then it can be extracted
using the formula:

=MID(A1,FIND(CHAR(1),SUBSTITUTE(
A1," ",CHAR(1),LEN(A1)-LEN(
SUBSTITUTE(A1," ",""))))+1,255)


--ron
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett
 
Posts: n/a
Default TEXT INTO COLUMNS

You could use a macro with
instrev
InStrRev Function


Description

Returns the position of an occurrence of one string within another, from the
end of string.

Syntax

InstrRev(stringcheck, stringmatch[, start[, compare]])

The InstrRev function syntax has these named arguments:

Part Description
stringcheck Required. String expression being searched.
stringmatch Required. String expression being searched for.
start Optional. Numeric expression that sets the starting position for
each search. If omitted, -1 is used, which means that the search begins at
the last character position. If start contains
Null, an error occurs.

compare Optional. Numeric value indicating the kind of comparison to
use when evaluating substrings. If omitted, a binary comparison is
performed. See Settings section for values.

--
Don Guillett
SalesAid Software

"genkate" wrote in message
...
I have a list of names; want to split into 2 columns-surnames & everything
else. format is always: john q. public/john public/j. p. public,etc. no
suffixes, nothing is after surname. All I need to do is count to the first
space from the RIGHT. Can Excel do that?

Thanks!
Kate



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
genkate
 
Posts: n/a
Default TEXT INTO COLUMNS

Yes, it worked great! Is there a way to extract the rest of the name into the
other column? Also, I found that there was a space after the surname. There
must be a way to delete that without deleting all the other spaces. Thank you
so much!
Kate
"Ron Rosenfeld" wrote:

On Fri, 17 Feb 2006 10:23:27 -0800, "genkate"
wrote:

I have a list of names; want to split into 2 columns-surnames & everything
else. format is always: john q. public/john public/j. p. public,etc. no
suffixes, nothing is after surname. All I need to do is count to the first
space from the RIGHT. Can Excel do that?

Thanks!
Kate



If the surname is always the last word in the cell, then it can be extracted
using the formula:

=MID(A1,FIND(CHAR(1),SUBSTITUTE(
A1," ",CHAR(1),LEN(A1)-LEN(
SUBSTITUTE(A1," ",""))))+1,255)


--ron

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default TEXT INTO COLUMNS

On Sat, 18 Feb 2006 13:36:30 -0800, "genkate"
wrote:

Yes, it worked great! Is there a way to extract the rest of the name into the
other column?


Same principle using the LEFT function:

=LEFT(A1,FIND(CHAR(1),SUBSTITUTE(
A1," ",CHAR(1),LEN(A1)-LEN(
SUBSTITUTE(A1," ",""))))-1)


Also, I found that there was a space after the surname. There
must be a way to delete that without deleting all the other spaces. Thank you
so much!


Is there always a space? Is it a normal space or a no-break space?

If it's a normal space, you could always wrap the Last Name formula in a TRIM
function:

=TRIM(MID(A1,FIND(CHAR(1),SUBSTITUTE(
A1," ",CHAR(1),LEN(A1)-LEN(
SUBSTITUTE(A1," ",""))))+1,255))





Kate
"Ron Rosenfeld" wrote:

On Fri, 17 Feb 2006 10:23:27 -0800, "genkate"
wrote:

I have a list of names; want to split into 2 columns-surnames & everything
else. format is always: john q. public/john public/j. p. public,etc. no
suffixes, nothing is after surname. All I need to do is count to the first
space from the RIGHT. Can Excel do that?

Thanks!
Kate



If the surname is always the last word in the cell, then it can be extracted
using the formula:

=MID(A1,FIND(CHAR(1),SUBSTITUTE(
A1," ",CHAR(1),LEN(A1)-LEN(
SUBSTITUTE(A1," ",""))))+1,255)


--ron


--ron


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
genkate
 
Posts: n/a
Default TEXT INTO COLUMNS

It must not be a normal space as this doesn't work unless I manually delete
space. However, once that's done, it works great.

Kate

"Ron Rosenfeld" wrote:

On Sat, 18 Feb 2006 13:36:30 -0800, "genkate"
wrote:

Yes, it worked great! Is there a way to extract the rest of the name into the
other column?


Same principle using the LEFT function:

=LEFT(A1,FIND(CHAR(1),SUBSTITUTE(
A1," ",CHAR(1),LEN(A1)-LEN(
SUBSTITUTE(A1," ",""))))-1)


Also, I found that there was a space after the surname. There
must be a way to delete that without deleting all the other spaces. Thank you
so much!


Is there always a space? Is it a normal space or a no-break space?

If it's a normal space, you could always wrap the Last Name formula in a TRIM
function:

=TRIM(MID(A1,FIND(CHAR(1),SUBSTITUTE(
A1," ",CHAR(1),LEN(A1)-LEN(
SUBSTITUTE(A1," ",""))))+1,255))





Kate
"Ron Rosenfeld" wrote:

On Fri, 17 Feb 2006 10:23:27 -0800, "genkate"
wrote:

I have a list of names; want to split into 2 columns-surnames & everything
else. format is always: john q. public/john public/j. p. public,etc. no
suffixes, nothing is after surname. All I need to do is count to the first
space from the RIGHT. Can Excel do that?

Thanks!
Kate


If the surname is always the last word in the cell, then it can be extracted
using the formula:

=MID(A1,FIND(CHAR(1),SUBSTITUTE(
A1," ",CHAR(1),LEN(A1)-LEN(
SUBSTITUTE(A1," ",""))))+1,255)


--ron


--ron

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default TEXT INTO COLUMNS

On Sat, 18 Feb 2006 20:02:27 -0800, "genkate"
wrote:

It must not be a normal space as this doesn't work unless I manually delete
space. However, once that's done, it works great.

Kate


If it is not a normal space, then it is probably a no-break space (ASCII
character code = 160) common in HTML documents.

To get rid of it in one step:

=SUBSTITUTE(MID(A1,FIND(CHAR(1),
SUBSTITUTE(A1," ",CHAR(1),LEN(A1)-
LEN(SUBSTITUTE(A1," ",""))))+1,255),
CHAR(160),"")

For simpler formulas, you could use something called regular expressions.

You can download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/

Then, for surname, you could use the formula:

=REGEX.MID(A1,"\w+",-1)

and for displaying everything except the last name:

=REGEX.MID(A1,".*(?=\s+\w+\W*$)")


--ron
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
genkate
 
Posts: n/a
Default TEXT INTO COLUMNS

That works great! You guys are so smart! I'm glad you're available!

k

"Ron Rosenfeld" wrote:

On Sat, 18 Feb 2006 20:02:27 -0800, "genkate"
wrote:

It must not be a normal space as this doesn't work unless I manually delete
space. However, once that's done, it works great.

Kate


If it is not a normal space, then it is probably a no-break space (ASCII
character code = 160) common in HTML documents.

To get rid of it in one step:

=SUBSTITUTE(MID(A1,FIND(CHAR(1),
SUBSTITUTE(A1," ",CHAR(1),LEN(A1)-
LEN(SUBSTITUTE(A1," ",""))))+1,255),
CHAR(160),"")

For simpler formulas, you could use something called regular expressions.

You can download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/

Then, for surname, you could use the formula:

=REGEX.MID(A1,"\w+",-1)

and for displaying everything except the last name:

=REGEX.MID(A1,".*(?=\s+\w+\W*$)")


--ron

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
How do I unwrap text to columns? ChristineR Excel Discussion (Misc queries) 2 December 9th 05 03:46 PM
Text to columns - one way street? Al Excel Discussion (Misc queries) 4 November 17th 05 04:31 PM
How do I convert from text to columns automatically on import? byosko Excel Discussion (Misc queries) 1 November 16th 05 11:21 PM
comparing columns of text (cross-searching) WorkingWithText Excel Discussion (Misc queries) 0 November 8th 05 02:30 AM
Text to columns jcross Excel Discussion (Misc queries) 2 July 21st 05 07:07 PM


All times are GMT +1. The time now is 04:34 AM.

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

About Us

"It's about Microsoft Excel"