Excel.Tips.Net ExcelTips (Menu Interface)

Pasting Leading Zeroes

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.

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:

  1. Select the cells that will hold the data you are going to paste.
  2. Choose the Cells option from the Format menu. Excel displays the Format Cells dialog box.
  3. Make sure the Number tab is selected. (See Figure 1.)
  4. Figure 1. The Number tab of the Format Cells dialog box.

  5. In the Category list, choose Text.
  6. Click on OK.

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.

Related Tips:

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!


Leave your own comment:

  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*What is 5+3 (To prevent automated submissions and spam.)
           Commenting Terms

Comments for this tip:

Clara    20 May 2016, 10:31
I have a column of data that is 5 digit numbers ie 00043. i need the column to be text, so i copied into notepad, formatted the column in excel to text, and pasted back into excel from notepad. The numbers that paste are now in text format, but some are lost. The first nine or so rows are "00000" and when i paste only one "00000" transfers. i have fewer rows than i started with and they do not match up with the other data in that row because of the lost data. suggestions?
Beverley    23 Jul 2015, 18:47
Worked perfectly, thank you! I was copying from SQL Server Management Studio and frustrated by the leading zeros disappearing in account coding.
awyatt    31 Jan 2015, 08:44
Micky, you are correct -- I misread what he asked.

If I follow the steps which I posted in the comment, below, I get exactly what I said -- exactly what the tip says.

If I do the copy from the browser window and paste using Ctrl+V into a Text-formatted cell, the leading zeroes do disappear. And, interestingly enough, Excel changes the format of the cell from Text back to General.

Very frustrating and potentially confusing. Excel seems to take the formatting of the original source into account when pasting. You can see this if you choose File | Paste Special to see the options that Excel gives you.

The Paste Special dialog box, when displayed with "from the browser" content in the Clipboard, shows three pasting options: HTML, Unicode Text, and Text. HTML seems to be the primary pasting option, as it is selected by default. When displayed with "from Notepad" content in the Clipboard, it shows only Unicode Text and Text as the pasting options.

I agree with you; the only way to make sure that the leading zeroes are retained when using Excel 2003 is to use Paste Special and choose either Text or Unicode Text as the pasting format. If, however, what you are copying started out as text (and cannot be interpreted by Excel as some other format, such as HTML), then you can skip using Paste Special and paste directly into the cell.

Michael (Micky) Avidan    31 Jan 2015, 05:55
After checking in "Excel 2003" it seems to be almost the same move:
Choose "Paste Special" > "Text".
Note: The cell(s) must be formatted as "Text" before applying the above procedure.
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
Michael (Micky) Avidan    31 Jan 2015, 05:43
You DID NOT do exactly(!) what he asked.
Try to copy/paste the 0012387 from row 9, in the above tip, into a cell (formatted as Text) and see what happens.
The easiest solution is to paste it via right click and selecting "Match Destination Format" (this is my free translation from my Hebrew interface 'Excel 2013')
*** Didn't check, yet, the behavior in Excel 2003)
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
awyatt    30 Jan 2015, 16:26
Did (again) exactly what you asked, Eric.

1. Opened Notepad and typed into it "0012387" (without the quote marks).
2. Started Excel and formatted a column as Text.
3. Switched back to Notepad, selected what I had typed in and pressed Ctrl+C to copy it.
4. Switched to Excel, selected a cell in the formatted column, and pressed Ctrl+V.

The result? The number showed, with leading zeroes--as text within the cell and like it looked in Notepad--just like the above tip states.

Eric    30 Jan 2015, 16:15
why do people post solutions like this that clearly don't work??? Mr Wyatt, why don't you format a column as text, and then copy/paste in 0012387 from your own article, and see what happens?

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us


Advertise with Us

Our Privacy Policy

Our Sites


Beauty and Style




DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)



Home Improvement

Money and Finances


Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives


Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2017 Sharon Parq Associates, Inc.