#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default City State Zip

When I use Text to Columns this separates fine until it gets to Oklahoma
City, Fort Smith, San Diego, Little Rock, etc. Then I get a separate column
for City, Smith, Diego, Rock. Raw data had City State and Zip all separated
by Spaces, no commas or tabs. The database is too long to do all of these
manually. Please Help Soon??!

Need this:
Little Rock AR 72207

to be:
|Little Rock|AR|72207|

Not:
|Little|Rock|AR|72207

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default City State Zip

One way:

A1: Little Rock AR 72207
B1: =LEFT(TRIM(A1),LEN(TRIM(A1))-9)
C1: =MID(TRIM(A1),LEN(TRIM(A1))-7,2)
D1: =RIGHT(TRIM(A1),5)

Copy down as far as necessary. Copy and Edit/Paste Special/Values
columns B:D

In article ,
Texas Nuckols wrote:

When I use Text to Columns this separates fine until it gets to Oklahoma
City, Fort Smith, San Diego, Little Rock, etc. Then I get a separate column
for City, Smith, Diego, Rock. Raw data had City State and Zip all separated
by Spaces, no commas or tabs. The database is too long to do all of these
manually. Please Help Soon??!

Need this:
Little Rock AR 72207

to be:
|Little Rock|AR|72207|

Not:
|Little|Rock|AR|72207

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bj bj is offline
external usenet poster
 
Posts: 1,397
Default City State Zip

before you do the text to columns use a helper column assuming your data is
in column A

=if(len(A1)-len(substitute(A1," ",""))=3,substitute(A1," ","-",1),A1)

copy paste down
copy and paste special values
test to columns on this helper column
note if you have names with three words you might have to repeat

"Texas Nuckols" wrote:

When I use Text to Columns this separates fine until it gets to Oklahoma
City, Fort Smith, San Diego, Little Rock, etc. Then I get a separate column
for City, Smith, Diego, Rock. Raw data had City State and Zip all separated
by Spaces, no commas or tabs. The database is too long to do all of these
manually. Please Help Soon??!

Need this:
Little Rock AR 72207

to be:
|Little Rock|AR|72207|

Not:
|Little|Rock|AR|72207

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 698
Default City State Zip

For the city

=LEFT(E2,LEN(E2)-8)

For the state

=MID(E2,LEN(E2)-7,2)

For the Zip

=RIGHT(E2,5)

Then Copy and Paste Special Values to get rid of the formulas.

HTH
Regards,
Howard

"Texas Nuckols" wrote in message
...
When I use Text to Columns this separates fine until it gets to Oklahoma
City, Fort Smith, San Diego, Little Rock, etc. Then I get a separate
column
for City, Smith, Diego, Rock. Raw data had City State and Zip all
separated
by Spaces, no commas or tabs. The database is too long to do all of these
manually. Please Help Soon??!

Need this:
Little Rock AR 72207

to be:
|Little Rock|AR|72207|

Not:
|Little|Rock|AR|72207



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
City State Zip Texas Nuckols Excel Discussion (Misc queries) 3 August 7th 07 10:56 PM
Compare City and State to Master List Not Excelerated[_2_] Excel Worksheet Functions 2 May 30th 07 01:44 AM
zip code to city, state function xcelentform Excel Worksheet Functions 1 May 18th 06 11:59 PM
city, state, zip in same cell whs2002 Excel Discussion (Misc queries) 2 April 29th 05 07:02 AM
Splitting City State Zip Pete Provencher Excel Worksheet Functions 2 February 7th 05 10:33 PM


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