What you will build

Complete “Fix leading zeros disappearing” using the visible Raw code, Safe text code sample so each action and the final state can be checked against the source data.

Learning objectives

Open the practice workbook

HANDS-ON PRACTICE

Practice in your own copy

Make your own Google Sheets copy with the same data, formulas, formatting, filter and frozen header. The original remains unchanged.

Make a Google Sheets copy (access required) ↗View original

Sign in to Google. If the original is not publicly shared, download the full workbook and import it into Google Sheets, or paste the example data into your own sheet.

Current Google Sheets result workbook showing Raw code and Safe text code values before re-running the troubleshooting steps.

Hands-on practice

Step 1: Select A2, enter 00123, and press Enter. Confirm that the cell displays 123 — this reproduces the leading-zero problem.

Google Sheets after entering 00123 into a General-formatted numeric cell, where the visible result becomes 123.

Step 2: For identifiers, prefix the entry with an apostrophe: type '00123 in B2 and '00045 in B3. After you press Enter, the apostrophe is not displayed in the cell, but it makes Sheets store the code as text.

Google Sheets after entering the safe text identifiers with a leading apostrophe so 00123 and 00045 remain visible.

Step 3: Confirm that B2 displays 00123 and B3 displays 00045 while A2:A3 remain 123 and 45 for comparison.

Final Google Sheets checkpoint with Raw code values 123 and 45 and Safe text code values 00123 and 00045.

Checkpoint

Raw codeSafe text code
12300123
4500045

Checkpoint: keep A2:A3 as the numeric comparison values; B2:B3 must display exactly 00123 and 00045 as text identifiers.

Common mistakes and fixes

Correction: re-enter the identifier with a leading apostrophe, for example '00123. If the earlier entry already became 123, Sheets cannot reconstruct the lost zeros automatically.

Independent practice

Add one row with the same schema, repeat the action, verify the new row behaves correctly, then remove it to restore the sample.

Key takeaways

  • ✓Google Sheets can remove leading zeros when an identifier is interpreted as a number.
  • ✓For identifiers, prefix the entry with an apostrophe so the value is stored as text.
  • ✓The leading apostrophe used to force text storage is not displayed in the cell after Enter.
  • ✓The correct checkpoint keeps B2 = 00123 and B3 = 00045 while A2:A3 are 123 and 45 for comparison.
  • ✓Do not use this text technique for values that need numeric calculations.
QUICK CHECK

Check your understanding

Answer four questions about the practice sheet.

1. Why can 00123 appear as 123?
2. Which entry preserves 00123 as a text identifier?
3. After pressing Enter on '00123, what does the cell display?
4. Which checkpoint is correct?

Next lesson

Continue in recommended learning order with Fix decimal and currency locale issues.

Next: Fix decimal and currency locale issues ↗