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 » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

text to column



 
 
Thread Tools Display Modes
  #1  
Old August 8th, 2008, 04:09 PM posted to microsoft.public.excel.worksheet.functions
mike
external usenet poster
 
Posts: 3,942
Default text to column

I have a column that contains email addresses, a space, and then a street
address which has spaces between the street number and the street name. In
some cases the street name can contain as many as 4 more spaces. I can't see
a way to tell the text to column feature to only look at the first space. I
would like to move the address to it's own column leaving the email address
in the first coulmn. There are 500 rows in the cloumn and not all of the
email addresses are the same length. What is the formula?
  #2  
Old August 8th, 2008, 04:42 PM posted to microsoft.public.excel.worksheet.functions
Teethless mama
external usenet poster
 
Posts: 3,722
Default text to column

Formula for email address:
=LEFT(A1,FIND(" ",A1)-1)

Formula for street address:
=MID(A1,FIND(" ",A1),99)


"Mike" wrote:

I have a column that contains email addresses, a space, and then a street
address which has spaces between the street number and the street name. In
some cases the street name can contain as many as 4 more spaces. I can't see
a way to tell the text to column feature to only look at the first space. I
would like to move the address to it's own column leaving the email address
in the first coulmn. There are 500 rows in the cloumn and not all of the
email addresses are the same length. What is the formula?

  #3  
Old August 8th, 2008, 04:52 PM posted to microsoft.public.excel.worksheet.functions
Gary''s Student
external usenet poster
 
Posts: 7,584
Default text to column

Just find the first blank.

With data in A1:

=LEFT(A1,FIND(" ",A1)) will give the text before the first blank
=MID(A1,FIND(" ",A1)+1,LEN(A1)-FIND(" ",A1)) will give the text after the
first blank

--
Gary''s Student - gsnu200798


"Mike" wrote:

I have a column that contains email addresses, a space, and then a street
address which has spaces between the street number and the street name. In
some cases the street name can contain as many as 4 more spaces. I can't see
a way to tell the text to column feature to only look at the first space. I
would like to move the address to it's own column leaving the email address
in the first coulmn. There are 500 rows in the cloumn and not all of the
email addresses are the same length. What is the formula?

  #4  
Old August 8th, 2008, 04:55 PM posted to microsoft.public.excel.worksheet.functions
mike
external usenet poster
 
Posts: 3,942
Default text to column

While this works, it leaves the source column and requires a cut and paste
step. Isn't there a way to simply parse this? Is there a step that could
insert a character after the email address such as a comma that I could then
use the text to cloumn feature?

"Teethless mama" wrote:

Formula for email address:
=LEFT(A1,FIND(" ",A1)-1)

Formula for street address:
=MID(A1,FIND(" ",A1),99)


"Mike" wrote:

I have a column that contains email addresses, a space, and then a street
address which has spaces between the street number and the street name. In
some cases the street name can contain as many as 4 more spaces. I can't see
a way to tell the text to column feature to only look at the first space. I
would like to move the address to it's own column leaving the email address
in the first coulmn. There are 500 rows in the cloumn and not all of the
email addresses are the same length. What is the formula?

  #5  
Old August 8th, 2008, 05:46 PM posted to microsoft.public.excel.worksheet.functions
Gary''s Student
external usenet poster
 
Posts: 7,584
Default text to column

If you select the cells to change and run this macro:

Sub mike()
For Each r In Selection
v = r.Value
n = InStr(1, v, " ")
v1 = Left(v, n - 1)
v2 = Right(v, Len(v) - n)
v3 = v1 & "^" & v2
r.Value = v3
Next
End Sub

It will change the first blank into a ^
You can then use Text to Columns.
--
Gary''s Student - gsnu200798


"Mike" wrote:

While this works, it leaves the source column and requires a cut and paste
step. Isn't there a way to simply parse this? Is there a step that could
insert a character after the email address such as a comma that I could then
use the text to cloumn feature?

"Teethless mama" wrote:

Formula for email address:
=LEFT(A1,FIND(" ",A1)-1)

Formula for street address:
=MID(A1,FIND(" ",A1),99)


"Mike" wrote:

I have a column that contains email addresses, a space, and then a street
address which has spaces between the street number and the street name. In
some cases the street name can contain as many as 4 more spaces. I can't see
a way to tell the text to column feature to only look at the first space. I
would like to move the address to it's own column leaving the email address
in the first coulmn. There are 500 rows in the cloumn and not all of the
email addresses are the same length. What is the formula?

  #6  
Old August 8th, 2008, 08:01 PM posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\)[_1049_]
external usenet poster
 
Posts: 1
Default text to column

As long as you are running code, why not just accomplish the task in code?

Sub mike()
For Each r In Selection
v = r.Value
n = InStr(1, v, " ")
r.Value = Left(v, n - 1)
r.Offset(0,1).Value = Right(v, Len(v) - n)
Next
End Sub

Rick


"Gary''s Student" wrote in message
...
If you select the cells to change and run this macro:

Sub mike()
For Each r In Selection
v = r.Value
n = InStr(1, v, " ")
v1 = Left(v, n - 1)
v2 = Right(v, Len(v) - n)
v3 = v1 & "^" & v2
r.Value = v3
Next
End Sub

It will change the first blank into a ^
You can then use Text to Columns.
--
Gary''s Student - gsnu200798


"Mike" wrote:

While this works, it leaves the source column and requires a cut and
paste
step. Isn't there a way to simply parse this? Is there a step that could
insert a character after the email address such as a comma that I could
then
use the text to cloumn feature?

"Teethless mama" wrote:

Formula for email address:
=LEFT(A1,FIND(" ",A1)-1)

Formula for street address:
=MID(A1,FIND(" ",A1),99)


"Mike" wrote:

I have a column that contains email addresses, a space, and then a
street
address which has spaces between the street number and the street
name. In
some cases the street name can contain as many as 4 more spaces. I
can't see
a way to tell the text to column feature to only look at the first
space. I
would like to move the address to it's own column leaving the email
address
in the first coulmn. There are 500 rows in the cloumn and not all of
the
email addresses are the same length. What is the formula?


  #7  
Old August 8th, 2008, 09:58 PM posted to microsoft.public.excel.worksheet.functions
Gord Dibben
external usenet poster
 
Posts: 20,252
Default text to column

In step 2 of DataT to C check the "treat consecutive delimiters as one"

The 4 spaces will become one space.


Gord Dibben MS Excel MVP

On Fri, 8 Aug 2008 08:09:00 -0700, Mike
wrote:

I have a column that contains email addresses, a space, and then a street
address which has spaces between the street number and the street name. In
some cases the street name can contain as many as 4 more spaces. I can't see
a way to tell the text to column feature to only look at the first space. I
would like to move the address to it's own column leaving the email address
in the first coulmn. There are 500 rows in the cloumn and not all of the
email addresses are the same length. What is the formula?


 




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 05:04 AM.


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