[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Pull City out of Address Cell

Posted on 2013-05-19
2
Medium Priority
?
496 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 1000 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 52

Accepted Solution

by:
Gustav Brock earned 1000 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

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
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: …

649 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