Solved

Pull City out of Address Cell

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

864 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now