+ Reply to Thread
Results 1 to 6 of 6

How to add leading zeros please

Hybrid View

  1. #1
    Registered User
    Join Date
    03-05-2012
    Location
    Yorkshire
    MS-Off Ver
    Excel 2016
    Posts
    79

    How to add leading zeros please

    Hi All (especially Rory )
    I have a file sent to me with part numbers in and prices however the lower sequenced part numbers that should have a leading zero have lost the zero prior to sending to me. They should all have 5 digits e.g 06766 but this appears as 6766. All part numbers starting with a character other than zero appear perfect e.g 12121 appears fine.How do I get the ones with the missing leading zero to get the zeros back please?

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: How to add leading zeros please

    =IF(LEN("reference")=4;"0"&"reference";"reference") (where "reference" is your data-cell)

    Be aware that your data will be treated as text by Excel.
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Registered User
    Join Date
    03-05-2012
    Location
    Yorkshire
    MS-Off Ver
    Excel 2016
    Posts
    79

    Re: How to add leading zeros please

    Hi Søren,
    thanks for the post. Excuse me but I cannot get it to work. I have replaced "reference" with A2 and get a message coming up saying a problem with the formula. I have previously used a method of formatting the row I think. Does that ring any bells please?

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: How to add leading zeros please

    You may have to replace the semi-colons with commas.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to add leading zeros please

    To keep the numbers as numbers but show a leading zero apply a custom format using 0####

  6. #6
    Registered User
    Join Date
    03-05-2012
    Location
    Yorkshire
    MS-Off Ver
    Excel 2016
    Posts
    79

    Re: How to add leading zeros please

    Thanks to all. Sorted

+ 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