Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Put Zero in Excel and Keep Leading Zeros

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To put a zero in Excel, simply click on a cell and type 0 using your keyboard, then press Enter. However, if you are trying to enter a number that starts with zero (a leading zero), such as a zip code or phone number, Excel will automatically delete it because it treats the entry as a mathematical value. To keep a leading zero, you must change the cell format to Text or use an apostrophe before the number.

What You'll Need

  • A computer with Microsoft Excel installed (Windows or macOS).
  • A keyboard with a numeric keypad or top-row number keys.

Step-by-Step

Depending on whether you need a single zero or a number that starts with zero, follow the appropriate method below. Note that menu labels may differ slightly depending on your version of Excel or region.

Method 1: Entering a Simple Zero

  1. Open your Excel workbook and select the cell where you want the zero to appear.
  2. Type 0 on your keyboard.
  3. Press Enter or Tab. The cell will now display a zero.

Method 2: Entering Leading Zeros (The Apostrophe Trick)

  1. Select the cell where you want to enter a number like "01234".
  2. Type a single quotation mark ('), also known as an apostrophe.
  3. Immediately type your number starting with zero (e.g., '01234).
  4. Press Enter. Excel will treat the entry as text and preserve the zero. The apostrophe will be visible in the formula bar but will not appear in the cell itself.

Method 3: Formatting Cells as Text (Best for Large Lists)

  1. Highlight the cells, columns, or rows where you plan to enter numbers with leading zeros.
  2. Go to the Home tab on the top ribbon.
  3. In the Number group, click the dropdown menu (which usually says "General" by default).
  4. Scroll down the list and select Text.
  5. Type your numbers starting with zero into these cells. Excel will no longer remove the leading zeros.

Method 4: Using Custom Number Formatting (For Consistent Lengths)

  1. Select the cells you want to format.
  2. Right-click the selected cells and choose Format Cells... (or press Ctrl + 1 on Windows).
  3. In the Number tab, select Custom from the Category list on the left.
  4. In the Type: box, enter a series of zeros representing the total number of digits you want. For example, if you want a 5-digit zip code and the number is "123", typing 00000 will force Excel to display "00123".
  5. Click OK.

Common Mistakes

  • Using "General" Format: The most common mistake is leaving the cell format as "General." In this mode, Excel assumes any number starting with 0 is a mathematical value and removes the zero because it has no numerical value.
  • Deleting the Apostrophe: If you used the apostrophe method, deleting the apostrophe in the formula bar will cause Excel to instantly convert the cell back to a number and strip the leading zero.
  • Confusing Text with Numbers: When you format a cell as "Text" to keep a zero, you cannot perform standard mathematical calculations (like SUM) on those cells as easily as you can with numeric values.

Tips

  • Quick Selection: If you need to apply the Text format to an entire column, click the letter at the top of the column (e.g., "A" or "B") before changing the format to Text.
  • Data Validation: If you are creating a form for others to fill out, use the "Text" format for ID columns to prevent users from accidentally losing their zeros.
  • Visual Cues: When a cell is formatted as text, you may see a small green triangle in the top-left corner of the cell. This is just a warning that a number is stored as text; you can ignore it or click the warning icon and select "Ignore Error."

Troubleshooting

If your zeros are still disappearing or not appearing as expected, try these steps in order:

  1. Check the Formula Bar: Click the cell and look at the formula bar at the top. If the zero is there but not in the cell, you likely have a Custom Number Format applied that is hiding it.
  2. Clear Formatting: Select the cell, go to the Home tab, click the Clear button (usually an eraser icon in the Editing group), and select Clear Formats. Then, try Method 2 or 3 again.
  3. Check for Hidden Columns: If you are typing zeros into a table and they aren't showing, ensure the column width is wide enough to display the content.
  4. Verify Data Type: If you imported data from a CSV file and the zeros are gone, you must format the columns as Text before importing the data, as Excel strips leading zeros during the import process.

Frequently Asked Questions

Why does Excel remove my zero when I type 00123?

Excel is designed for calculations. In mathematics, 00123 is the same as 123, so Excel automatically simplifies the number by removing the unnecessary leading zeros to save space and maintain numerical accuracy.

Will using an apostrophe change how my data is sorted?

Yes. When you use an apostrophe or format a cell as Text, Excel sorts the data alphabetically (as text) rather than numerically. For example, "10" might come before "2" in a text sort.

Can I add zeros to existing numbers automatically?

Yes, you can use the Custom Number Format method (Method 4) to add zeros to existing numbers without re-typing them. Alternatively, you can use a formula like =TEXT(A1, "00000") to create a new column of formatted numbers.

Does formatting as Text delete my data?

Changing the format to Text does not delete existing data, but it may change how that data is displayed or handled in formulas. It is always a good idea to keep a backup of your data before applying bulk formatting changes.

Can I put a zero in a cell and have it stay centered?

Yes. Enter the zero using any of the methods above, then use the Alignment tools in the Home tab to select "Center" alignment.