+ Reply to Thread
Results 1 to 5 of 5

Zero prefix

  1. #1
    Registered User
    Join Date
    07-09-2007
    Posts
    68

    Zero prefix

    Hi I have a list of 5 digit numbers that I want to prefix with a Zero. Eg 12345 should 012345. I have tried Format/Custom and entering 6 numbers and it actually shows the correct format in the sample.However when I go back to the spreadsheet the number in the white box after the formula bar stays as only 5 digits without the zero prefix. Is there a way to fix this please?

    thanks

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Zero prefix

    Without physically altering the original value you would need to enter a formula in an adjacent cell to convert to Text: =TEXT(A1,"000000")

    Can we ask why you need this ? The Custom Format approach would normally suffice.

  3. #3
    Registered User
    Join Date
    07-09-2007
    Posts
    68

    Re: Zero prefix

    Hi its because we are in payroll and need to allocate a set number of digits for each person (ie 6 in this case). Ive tried what you said and it works to an extent(ie it shows in excel) but the system doesnt like the leading zero still presumably because it is in text mode rather than number.

  4. #4
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,924

    Re: Zero prefix

    Try this,

    =RIGHT("000000" & A1,6)

    HTH,
    WindKnife

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Zero prefix

    OK to try and clarify the situation...

    You can't have

    000001 as both a literal value and a numeric type simultaneously because 000001 as a number is 1 ... keeping the numeric type all you can do is apply a Custom Format to the cell so as to display the leading zeroes (as you had done previously).

    If you want 000001 literally it will have to be a text string.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1