Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Pasting Leading Zeroes.
by Allen Wyatt
(last updated July 20, 2013)
Some data requires leading zeroes. The first example that comes to mind is ZIP Codes, in which some have leading zeroes. There are other examples, as well. For instance, you may have a chart of accounts in which general ledger account numbers start with leading zeroes.
When you paste information into Excel, it normally tries to "parse" the data and put it in a format that it can work with. When you paste data that have leading zeroes, and the data could reasonably be construed as numbers, then Excel strips the leading zeroes from what you are pasting. For instance, 0012387 become a number value, 12387.
What if you want to retain the leading zeroes? All you need to do is make sure that the target cells—the ones that will receive the data being pasted—are formatted as text. Follow these steps:
Figure 1. The Number tab of the Format Cells dialog box.
Whatever you now paste into the formatted cells is assumed to be text, and Excel will leave your leading zeroes exactly as you expect them.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2752) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Pasting Leading Zeroes.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Given a long list of names, part numbers, or what-have-you, you may need to determine the unique values within the list. The ...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 menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.