How to Prevent Excel from Removing Leading & Trailing Zeros

Method 1 of 2:

Storing Numbers as Text

  1. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 1
    Add an apostrophe before the number. If you only need to correct a few cells, you can fix them one at a time. Edit each cell to start with an apostrophe ('), then type the number exactly as it should appear. The apostrophe tells Excel to store this cell as text, meaning it cannot be used for formulas.
    1. If you need to use the numbers in formulas, skip down to custom number format instructions.
  2. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 2
    Save a large database in text format. Once you import data into a default Excel workbook, the leading and trailing zeros disappear permanently. The easiest way to fix this is to clear the faulty data and start again. Return to your original database and save it as a .csv file or a .txt file.
  3. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 3
    Create a new Excel workbook. You will import your data into this workbook as text, meaning it will not be usable in formulas. You will, however, keep the formatting.
    1. This method does allow you to import some columns as text and some columns as numbers. Only the text columns will keep leading and trailing zeros.
  4. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 4
    Open the Text Import Wizard. Click the Data tab on your ribbon menu, then look in the External Data Sources section. Click the icon labeled Text or From Text.[1]
  5. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 5
    Import data from the text document. Select the text file in the "Choose a File" window. Follow the onscreen instructions to complete Steps 1 and 2.
  6. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 6
    Set columns to text format. In Step 3 of the Text Import Wizard, you should see a preview of your spreadsheet. Click on a column to select it, then select an option to set the format for that column. Specifically, to keep leading and trailing zeros in columns containing phone numbers and similar data, select those columns and choose Text. You can now complete the import and load your spreadsheet with the zeros, as intended.
Method 2 of 2:

Creating Custom Number Formats

  1. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 7
    Select the cells you need to change. A custom number format specifies the exact format for your data, including the number of leading or trailing zeroes. To begin, select the columns, rows, or groups of cells you'd like to change.
  2. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 8
    Open the Format window. Click the Home tab on the ribbon and look in the Number group. On Excel for Windows, click the dialog launcher next to the word Number (a small arrow in a square).[2][3] On Excel for Mac, click the dropdown menu (it says General by default) and select Custom....
    1. On old versions of Excel without a ribbon menu, instead click FormatCellsNumber tab.[4]
  3. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 9
    Create a custom format. In Excel 2013 and Excel 2016, just select any format on the list. When you edit that default format, Excel will automatically create a new custom format without altering the default option.[5] On all other versions of Excel, select Custom from the list of options instead. Look for a text box labeled Type where you can enter your custom format.
    1. If your data represents calendar dates, phone numbers, or other common data types, browse the list of default options. You may be able to use one of them rather than creating your own format.
  4. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 10
    Add leading zeroes. Custom formats use several "placeholder characters" to specify how digits should display. The character 0 (zero) tells Excel to display a zero in that position if there is no other digit there.[6] For example, the format 000 will add leading zeroes to the hundreds and tens place if necessary. 97 will display as 097, and 3 will display as 003.
    1. Numbers to the left of the decimal point are always displayed. Even though there are only three digits in the format code 000, the number 3750 will still display as 3750.
  5. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 11
    Specify decimal places and trailing zeroes. Custom number formats will delete all digits after the decimal point unless you specify otherwise. To change this, just add a decimal point to the end of your custom code, followed by 0 (or one of the placeholder characters described below).[7] For example, 000.000 will round to the nearest thousandth, and add up to three trailing zeros after the decimal point. Here's how various numbers look in the 000.000 format:
    1. 13.1 becomes 013.100
    2. 95001 becomes 95001.000
    3. 5.0057 becomes 5.006
  6. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 12
    Use the pound sign to prevent extra zeroes. The symbol # is another placeholder character in custom formats. This will prevent all leading zeroes if used at the front of the number, and prevent all trailing zeroes if used after the decimal point.[8] For example, the custom format 00.## allows for a leading zero in the tens place, but no trailing zeroes:
    1. 5.8 becomes 05.8
    2. 2.71 becomes 02.71
    3. 15.0 becomes 15
    4. 38.315 becomes 38.32
  7. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 13
    Add leading zeros as text. Excel treats anything inside quotation marks as text in your custom format, and will display it exactly as you typed it.[9] This may be useful if each cell in your original database had exactly two leading zeros, for example. To restore these, set your spreadsheet to the custom format "00"#.
    1. If your data includes digits after a decimal point, prevent rounding by using the custom format "00"#.## instead, using as many # or 0 characters after the decimal point as necessary.
  8. How to Prevent Excel from Removing Leading & Trailing Zeros Picture 14
    Align decimal points with a question mark. If your goal is to align the decimal points in a column, there's no need to add leading or trailing zeroes. Use the ? character in your custom format, and Excel will add empty spaces instead to align the digits in the column. For example:
    1. ?.??? rounds to the nearest thousandth with no trailing zeroes, and aligns the decimal points.
    2. 000.? adds leading zeros up to the thousands place, rounds to the nearest tenth with no trailing zeros, and aligns the decimal points.
    3. ?.00 rounds to the nearest hundredth with trailing zeros and aligns the decimal points.
4 ★ | 173 Vote

May be interested

  • How to create a password protection for Excel sheetsHow to create a password protection for Excel sheets
    in addition to creating passwords for excel files, we can proceed to set the password for each sheet in excel data to prevent the ability to edit the sheet content, but can still view the content.
  • How to separate thousands by commas in ExcelHow to separate thousands by commas in Excel
    the decimal number on excel will help us separate thousands, hundreds, ... units when entering the calculation number or with the currency in the data table.
  • This is a simple way to find and delete Hyperlink in ExcelThis is a simple way to find and delete Hyperlink in Excel
    if spreadsheet excel has many hyperlinks, then you want to remove these hyperlinks. however, with so many hyperlinks, removing hyperlinks will take a long time. so how to find and delete all hyperlinks on excel file, please refer to the following article of network administrator.
  • How to Open a Password Protected Excel FileHow to Open a Password Protected Excel File
    this wikihow teaches you how to remove the password from a protected excel spreadsheet, as well as how to attempt to find out the password for an encrypted excel file. keep in mind that, while removing the password from an editing-locked...
  • How to prevent and treat dry eyes effectivelyHow to prevent and treat dry eyes effectively
    eye dryness not only causes discomfort, it affects the quality of life, but it can also cause corneal ulcers, corneal scars leading to blindness. here's how to prevent and treat dry eye effectively.
  • How to Find Duplicate Data in ExcelHow to Find Duplicate Data in Excel
    when working on microsoft excel spreadsheets with lots of data, it is likely that you will encounter duplicate values. microsoft excel's conditional formatting feature will correctly display duplicate locations, while the remove duplicates action will remove those entries. reviewing and removing duplicates ensures the accuracy of your data and presentation.
  • How to Open Password-Protected Excel FilesHow to Open Password-Protected Excel Files
    this article explains how to remove the password of a protected excel worksheet and how to crack the password of an encrypted excel file. in most cases, removing the password of a worksheet that is locked from editing in an excel file is quick and simple! however, if you need a password to open the file, the operation will be more complicated. there is no official way to decrypt excel files without using a password cracking program - often a resource-intensive process depending on the complexity of the password. you should still try it though!
  • Steps to lock columns in ExcelSteps to lock columns in Excel
    locking columns in excel with a password helps you protect columns, prevent others from changing column content or editing columns, affecting all data of the table.
  • How to Reduce Excel File SizeHow to Reduce Excel File Size
    today's wikihow will show you how to reduce microsoft excel file storage space by removing some formats, compressing images, or saving the file in a lighter format.
  • ABS function in Excel, formula, usage and examplesABS function in Excel, formula, usage and examples
    the abs function in excel helps calculate the absolute value of a number, removing the negative sign to return a positive number. this is an important function in data processing, especially when working with negative numbers or calculations that require positive values.