Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-10-2014, 08:40 PM
sinaranje sinaranje is offline How to use mid or left functions to seperate city,st,zip with no commas Windows 7 64bit How to use mid or left functions to seperate city,st,zip with no commas Office 2003
Banned
How to use mid or left functions to seperate city,st,zip with no commas
 
Join Date: Nov 2014
Location: GB
Posts: 1
sinaranje is on a distinguished road
Default How to use mid or left functions to seperate city,st,zip with no commas

Hi all,



I have a list of approx. 2000 address that are in the following format

|Address 2|

Los Angeles CA 90210
Miami FL 20200
Bethesda MD 20817

My desired format:

City| State | Zip

Los Angeles CA 90210

All of these addresses have no commas to appropriately separate the city from the state or zip. Therefore using a mid function to pull out CITY, STATE, ZIP is difficult.

Does anyone have some ideas on how to segregate them? Thanks.
Attached Files
File Type: xlsx example for forum 1.xlsx (11.4 KB, 9 views)
Reply With Quote
  #2  
Old 11-10-2014, 10:21 PM
excelledsoftware excelledsoftware is offline How to use mid or left functions to seperate city,st,zip with no commas Windows 7 64bit How to use mid or left functions to seperate city,st,zip with no commas Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Assuming that all of your addresses have 5 digit zipcodes and 2 character states you can use a combination of mid, right, and len formulas to do this quite easily.

The following formulas start with addresses in cell A2
Code:
For the City: =MID(A2,1,LEN(A2)-9)
For the State: =MID(A2,LEN(A2)-7,2)
For the Zip: =RIGHT(A2,5)
Let me know if that works out.

Thanks
Reply With Quote
  #3  
Old 11-10-2014, 10:28 PM
excelledsoftware excelledsoftware is offline How to use mid or left functions to seperate city,st,zip with no commas Windows 7 64bit How to use mid or left functions to seperate city,st,zip with no commas Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Here is your attachment with the formulas filled in. Some of your addresses have an extended zip code. Just filter these and run the formula in red font for these addresses.
Attached Files
File Type: xlsx example for forum 1.xlsx (14.0 KB, 9 views)
Reply With Quote
  #4  
Old 11-11-2014, 03:28 AM
macropod's Avatar
macropod macropod is offline How to use mid or left functions to seperate city,st,zip with no commas Windows 7 64bit How to use mid or left functions to seperate city,st,zip with no commas Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For the City: =LEFT(C2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},C2 & "0123456789"))-5)
For the State: =MID(C2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},C2 & "0123456789"))-3,2)
For the Zip: =RIGHT(C2,LEN(C2)+1-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},C2 & "0123456789")))
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 11-11-2014, 10:52 PM
excelledsoftware excelledsoftware is offline How to use mid or left functions to seperate city,st,zip with no commas Windows 7 64bit How to use mid or left functions to seperate city,st,zip with no commas Office 2003
IT Specialist
 
Join Date: Jan 2012
Location: Utah
Posts: 455
excelledsoftware will become famous soon enough
Default

Quote:
Originally Posted by macropod View Post
For the City: =LEFT(C2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},C2 & "0123456789"))-5)
For the State: =MID(C2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},C2 & "0123456789"))-3,2)
For the Zip: =RIGHT(C2,LEN(C2)+1-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},C2 & "0123456789")))
Wow Macropod, I never knew you could use curly braces in a search formula like that. I learned something really important today. Thanks.
Reply With Quote
Reply

Tags
address, function, separate



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use mid or left functions to seperate city,st,zip with no commas Suppress comma in "city , stat zip" line when blank DHammer Mail Merge 1 05-30-2014 02:43 AM
How to use mid or left functions to seperate city,st,zip with no commas No inverted commas in word 2013. tonycrossley Word 3 01-27-2014 04:55 PM
How to use mid or left functions to seperate city,st,zip with no commas mail merge treating CITY as DATE woody Mail Merge 6 01-30-2013 03:22 PM
How to use mid or left functions to seperate city,st,zip with no commas Merge to Seperate Documents joughin Mail Merge 1 05-17-2012 05:08 PM
Seperate Column widths in one worksheet miller.3276 Excel 2 01-27-2010 02:12 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:05 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft