exact length of the cell

  • Thread starter Thread starter sabi0398
  • Start date Start date
S

sabi0398

I need to add a leading 0 if the length of the text is less than 10 char
Example: I have in A1 34126 so I need to 5 leading 0s in front
or
96750004 -so I need to add 2 leading 0s in front
What is the way to do it?
 
Use a custom number format of: 0000000000

Format>Cells>Number tab>Custom
Below "Type:" enter 10 zeros
OK
 
sabi,

Note that formatting the cells will not change the actual length of the string, just how it is
displayed.

Use = TEXT(A1,"0000000000")

if you need the actual length to be 10 - copy the formula and paste down to match your data. You
can also copy those formula and paste values over the original data if that is required.

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Leading digits 5
How to open a csv file without auto converion 2
Pivot Table 1
Excel spreadsheet 2
Probably a Stupid Question 10
Accumulated Time Format 2
numeric format 2
Leadin 0s 1

Back
Top