Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Shortening ZIP Codes.
by Allen Wyatt
(last updated December 13, 2014)
In the United States, ZIP Codes come in two formats: five-digit and nine-digit. (Actually, the five-digit ZIP Code is a subset of the nine-digit ZIP Code.) If you are an Excel worksheet that contains address information, you may want to convert nine-digit ZIP Codes to their five-digit equivalent.
This is a rather easy task to accomplish, since all you need to do is strip everything after the fifth digit in the ZIP Code. Follow these steps:
Figure 1. The Paste Special dialog box.
If you have an empty column to the right of your ZIP Codes, you can also use Excel's Text to Columns feature:
Figure 2. The first step of the Convert Text to Columns Wizard.
At this point you have the first five digits of the ZIP Code in the original column and the last four digits (if any) in the previously empty column to the right. You can delete the column containing the four digits, if desired.
If you need to truncate ZIP Codes quite often, you may be more interested in a macro-based approach. The following macro will do the trick:
Sub ZIPShorter() For Each cell In Selection cell.Value = Left(cell.Value, 5) Next End Sub
All you need to do is select the cells containing the ZIP Codes, and then run the macro.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10768) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Shortening ZIP Codes.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
Excel includes the powerful INDIRECT function which can be used to assemble references to other cells in your workbook. ...Discover More
When you discover that there is an invalid reference in a workbook, you can have a bear of a time tracking down the ...Discover More
Remember your number line from your early years in school? Some numbers can be below zero (negative numbers) and others ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.