Solved

Pull out zip code?

Posted on 2014-10-10
5
78 Views
Last Modified: 2014-10-27
I have addresses in a cell that is the below format. How do I pull out just the zip code?

2725 Agoura Rd, Thousand Oaks, CA 91361
0
Comment
Question by:cansevin
  • 3
5 Comments
 
LVL 37

Expert Comment

by:bbao
ID: 40373568
if the addresses are for US only and the zip codes are always at the end of the addresses after their two-letter state name, you may simply extract the 5-digit zip codes by using string functions.
0
 
LVL 25

Accepted Solution

by:
ProfessorJimJam earned 500 total points
ID: 40373576
=UPPER(TRIM(RIGHT(SUBSTITUTE(TRIM(A1)," ",REPT(" ",99)),99)))
0
 
LVL 25

Expert Comment

by:ProfessorJimJam
ID: 40373600
in case if you want to pull the two digit State, let me save you time , and cover it also in this thread to pull only State CA  then here is formula   =UPPER(MID(A1,FIND(",",A1,1)+2,2))
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40373801
Cool function, ProfessorJimJam, for pulling out the zip code.    

No points, but....
The function to pull the state code doesn't work (shows first two letters of city in uppercase), but this formula will show the state code:
=RIGHT(LEFT(A1,LEN(A1)-LEN(TRIM(RIGHT(SUBSTITUTE(TRIM(A1)," ",REPT(" ",99)),99)))-1),2)

Note that it uses the LEN of the result found for the zip code as part of this.

-Glenn
0
 
LVL 25

Expert Comment

by:ProfessorJimJam
ID: 40373815
Thank you Glenn.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel cell formatting 5 27
Excel IF formula 3 19
Rather Simple Formatting Question 6 23
Need VBA to copy data from one worksheet to main worksheet 7 13
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

776 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