ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   City State Zip (https://www.excelbanter.com/excel-worksheet-functions/153331-city-state-zip.html)

Texas Nuckols

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


JE McGimpsey

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


bj

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


L. Howard Kittle

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





All times are GMT +1. The time now is 09:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com