How to specify format of number


#1

Dear all,

I have excel sheet which contains some card number. It start from 1 upto 9999.
But other system needs to recognize those number as 8 length fixed number. 000001 - 009999.

If I read the excel date, the number was converted to 1 - 9999.
Is there any method to output the number as 000001 - 009999 ?

Thank you very much.


#2

Hi,
I hope this will helpful to You…

one.ToString(“D3”)

Input is 1…
Ouput is 001…

Regards,


#3

add single quote(’) to the number then write to the excel, like '000001 and '0099999


#4

hello @Kn.opp use this excel function =Text(A1,“00000000”) this will add single quote at starting just like @ddrdushy1 said. Useful if there are mutliple rows.


#5

sorry misunderstand, to change 1 to 00000001 use below code
Integer.parse(“1”).toString(“00000000”)


#7

Thanks Hemanth,

It helps me a lot! Thank you very much!


#8

ddrdushy1
Thank you very much for your help on this!!!