Solved

Pull out zip code?

Posted on 2014-10-10
5
76 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:Bing CISM / CISSP
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

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

Suggested Solutions

Title # Comments Views Activity
Macro Capitalize 4 50
highlight duplicate entry 16 26
Highlighting cells in Excel 9 16
Excel:  Find text between 2nd hyphen and next space 10 29
A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

947 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

23 Experts available now in Live!

Get 1:1 Help Now