View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
PMC1 PMC1 is offline
external usenet poster
 
Posts: 23
Default Need 7 digit number with differnt number of leading zeros

On Jul 30, 11:43*am, malycom
wrote:
Hi

I have a single column of data of ascending numbers which was in an .req
file format (text) which I opened in Excel. *The lowest number is 3128 and
the largest number is 999999 with all numbers in between.

These numbers were all 7 digits with leading zeros such as *0003128 right
through to 0999999 and again, everything in between. *Unfortunately, I saved
the changes I made in the spreadsheet and all the leading zeros were lost..

I can not for the life of me find anyway of getting 3 leading zeros to all
the numbers with 4 digits, 2 leading zero for the numbers with 5 digits and 1
leading zero for the numbers with 6 digits. *I desperately need this sorted
as these numbers are unique identifiers for a download that occurs daily.

0003128 - 0009999
0010000 - 0099999
0100000 - 0999999

Is there anybody who can help me to convert these numbers back to their
original format.

Thanks in advance

Malcolm


Hi Malcolm,

This basic but it will work. Format a column as text and enter this
formula then copy down the required number of rows

=IF(LEN(A1)=4,"000"&A1,IF(LEN(A1)=5,"00"&A1,IF(LEN (A1)
=6,"0"&A1,A1)))

(Where the numbers are in column A)

Hope this helps

Paul