+ Reply to Thread
Results 1 to 4 of 4

How do I force a leading zero character eg 07817

  1. #1
    m800afc
    Guest

    How do I force a leading zero character eg 07817

    I am entring in order codes on a stock order sheet. The codes have 5 digits.
    Some of them begin with 0 (zero). How do I force the cell to report the
    correct number, ie 07817, and not 7817 as it is doing at the moment?

    Thanks

    Tony

  2. #2
    Gary''s Student
    Guest

    RE: How do I force a leading zero character eg 07817

    Just enter the numbers preceeded by an apostrophe (single quote)
    --
    Gary''s Student


    "m800afc" wrote:

    > I am entring in order codes on a stock order sheet. The codes have 5 digits.
    > Some of them begin with 0 (zero). How do I force the cell to report the
    > correct number, ie 07817, and not 7817 as it is doing at the moment?
    >
    > Thanks
    >
    > Tony


  3. #3
    David Biddulph
    Guest

    Re: How do I force a leading zero character eg 07817

    "m800afc" <[email protected]> wrote in message
    news:[email protected]...
    >I am entring in order codes on a stock order sheet. The codes have 5
    >digits.
    > Some of them begin with 0 (zero). How do I force the cell to report the
    > correct number, ie 07817, and not 7817 as it is doing at the moment?


    Format the cell as text before you enter the number.
    --
    David Biddulph



  4. #4
    Registered User
    Join Date
    03-17-2006
    Posts
    9

    leading zero

    I had a similar issue with data containing leading zeroes. Excel would promptly clip them off making the use of lookups, etc... useless. Here is what I did:
    (Assuming you need a fixed length of 5 char)

    A B C
    1 NUM DESC FORMULA
    2 1 apple =REPT("0",5-LEN(a2))&A2
    3 22 orange =REPT("0",5-LEN(a3))&A3
    4 304 pear =REPT("0",5-LEN(a4))&A4

    What it does:
    =REPT("s",x) Repeats "s" (or whatever string), x times)
    =LEN(a2) Returns the char count of a2

    The combined formula repeats "0" for (5 - length of a2), &a2 concatenates the value of a2 to the end. Replace 5 with whatever fixed length you need.

    Regards and good luck!

    Jay
    Last edited by jbrackett; 03-22-2006 at 03:30 PM.

+ 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