Retain zeros in a cell

Louise Wooding 155 Reputation points
2025-08-27T13:54:01.2866667+00:00

How do I enter a number but retain the zeros at the beginning? The numbers will all be different lengths - I thought of creating a custom number but can't get it to work. TIA

Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments

Answer accepted by question author
Anonymous
2025-08-28T00:11:31.3666667+00:00

Hi @Louise Wooding

Welcome to the Q&A Community 

I’m here to assist with your problem. 

To retain leading zeros when entering numbers of varying lengths in Excel (while storing them as text for VLOOKUP compatibility, without using an apostrophe), follow these steps: 

  • Select the cell(s) or range where you'll enter the data. 
  • Right-click and choose Format Cells (or press Ctrl+1 on Windows / Cmd+1 on Mac). 
  • In the Format Cells dialog, go to the Number tab. 
  • Under Category, select Text
  • Click OK

User's image

User's image

Now, when you enter a value like 00123 into those cells, Excel will treat it as text and preserve the leading zeros exactly as typed. This works for any length, as it's not applying a fixed numeric format. 

  • For VLOOKUP: Ensure the lookup value and the table array column are both formatted as text for consistent matching. If needed, you can convert existing numeric data to text using the TEXT function (e.g., =TEXT(A1, "0")) or by selecting the range, going to Data > Text to Columns > Delimited > Next > Next > Text (under Column data format) > Finish. 
  • Noted: Once stored as text, arithmetic operations won't work directly on these values (e.g., summing them), but you can convert temporarily with VALUE() if needed (e.g., =VALUE(A1) + 10). 

User's image

We appreciate your kind patience and understanding that sometimes the initial response may not immediately resolve the issue or there may be some misunderstandings about your scenario, but we would love to hear updates from you and find out further suggestions. 

Thank you for your kindness and understanding. If you need anything else, please feel free to contact me.  


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment" 

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. 

User's image

Was this answer helpful?


2 additional answers

Sort by: Most helpful
  1. Louise Wooding 155 Reputation points
    2025-09-01T15:33:43.5833333+00:00

    Hi. so sorry to bother you - I'm trying to post another question but I just keep getting told there's an error. This new AI feature it now uses doesn't work very well and rarely answers the question but then if I unselect AI, I don't get any further and just get an error message every time. I notice this has changed recently with how it works and isn't as efficient. Is there a problem with posting questions recently? I used to use this a lot and it worked amazingly well when you got through to 'real people'. Thank you and, again, sorry to bother you. Louise

    Was this answer helpful?


  2. HansV 462.7K Reputation points MVP Volunteer Moderator
    2025-08-27T14:25:16.0966667+00:00

    If these values are primarily identifiers, such as product numbers, you should store them as text instead of as numbers. You can do this by formatting the cells as Text before entering the values, or by prefixing the values with an apostrophe '. The apostrophe will be displayed in the formula bar but not in the cell itself.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.