Converting number to have leading zeros and punctuation mark

Copper Contributor

Trying to convert 3 to '0003, but where the result does not show the ' instead we want it to just show 0003 with the green triangle in the corner. Have tried numerous formats and functions.

7 Replies
Hi Bill

Not sure I follow the logic although it could be just my understanding.

If 3 is converted to '0003, then I am not sure how it will not show the ' if the answer will always have it? When would the result not have the '?

Cheers
Damien

Trying to assist a colleague with this. He said that the person that trained him on his spreadsheet showed him a way to make it come out the way we want, but he did not take notes. The other person retired over a year ago so we don't know what she had done. Essentially we are attempting to get the same result as when you physically type '0003 into the cell (which gives you 0003 with the little warning message that a number is stored as text) from an initial value of 3. Seems odd, but the apostrophe has to be there due to how the data pulls from the sheet to where it gets downloaded. And we are trying to find an easier way than manually updating 500 cells.

Hi Bill,

 

Perhaps you don't need a text but number representing with leading zeroes. If so you may just apply custom format like

000#

to all your few hundred cells. The result will be like

image.png

 

 

Hi Bill

Without seeing the original file in action, I don't have any ideas on how to get your document working for you.

It may also be worth reaching out to the now retired individual to see if they are happy to remind your colleague on how that worked (professional courtesy and what not).

Sorry I don't have a better answer for you.

Best wishes with the spreadsheet.

Cheers
Damien

@Sergei Baklan 

This works perfectly!  However, for clarification, when creating the Custom Format, the number of 0's input into the format will be the number displayed.  However, I found that if you have a six-digit number to display (e.g. 000245), the Custom Format code needs to be "000###" - including one # for each non-zero number you wish to display.  Interestingly, if you only enter "000##" as the format code for your six-digit number with three leading zeros, the result will be "00245" - it will truncate the displayed number starting at the left - overwriting the desire to display three leading zeros... 

If I may, you don't need a # sign for each non-zero number. It just means display a number if there is one and don't display one if there is not a number in that place.

A zero means display a zero if there is not a number in that place. So 00000# will show 245 as 000245.

You could also use 000000, but there's no difference if your data is integers as you'll always have at least one integer.

@scottmccanna 

Please check Excel custom number formats which explains how custom number format works. Lot of other info as well.