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
Solved

Pull City out of Address Cell

Posted on 2013-05-19
2
486 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
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 49

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

808 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