Solved

Pull City out of Address Cell

Posted on 2013-05-19
2
489 Views
Last Modified: 2013-05-20
I have column of address in the format:

Street Address, City, State such as:

10675 Scripps Poway Pkwy, San Diego, CA

In Column e I need just the city (everything in between the two columns.)
0
Comment
Question by:cansevin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Assisted Solution

by:ecarbone
ecarbone earned 250 total points
ID: 39178686
Assuming your list of complete addresses start in cell D1, copy/paste this formula into cell E1:

=TRIM(LEFT(RIGHT(SUBSTITUTE(D1,",",REPT(" ",100)),200),100))

Once you past the cell into E1, you can copy/paste that formula all the way down the column. Excel will automatically put in the next cell reference (E2, E3, E4, and so on)

Finally... after you verify that column E contains your cities, you can extract the actual values by doing this:

1. Click once on the 'E' in column E. This selects the entire column
2. Press Control-C to copy the entire column into your clipboard
3. Right-click on Column F (assuming it is empty) and select Paste | Values

Now column F will contain the actual value (city name) instead of a formula.
0
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 250 total points
ID: 39178840
In your query you can use:

SELECT
  Mid([YourField],1,InStr([YourField],",")-1) AS Address,
  Mid(Mid([YourField],InStr([YourField],",")+1),1,InStr(Mid([YourField],InStr([YourField],",")+1),",")-1) AS City
FROM YourTable;

/gustav
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question