+ Reply to Thread
Results 1 to 7 of 7

Another Zero problem...

  1. #1
    Squeaky
    Guest

    Another Zero problem...

    I need to remove all the leading zeros from a part number column on my
    spreadsheet by formula in an adjacent column. There can be none or up to 4
    zeros at the beginning, and some entries are alpha-numeric. (So multiplying
    by 1 or adding 0 won't work.) The problem comes when trying to perform a
    vlookup. If I don't enter the zero's, I get a "not found". If there is a way
    for vlookup to ignore the leading zero's that will work too.

    Thanks!

    Squeaky

  2. #2
    Kevin B
    Guest

    RE: Another Zero problem...

    You can use the SUBSTITUTE formula to substitute all zeroes with an empty
    string.

    =SUBSTITUTE(A1,0,"")

    Where A1 is the cell containing your part number
    0 is the character you want to replace
    and "" is what you want to replace the zero with
    --
    Kevin Backmann


    "Squeaky" wrote:

    > I need to remove all the leading zeros from a part number column on my
    > spreadsheet by formula in an adjacent column. There can be none or up to 4
    > zeros at the beginning, and some entries are alpha-numeric. (So multiplying
    > by 1 or adding 0 won't work.) The problem comes when trying to perform a
    > vlookup. If I don't enter the zero's, I get a "not found". If there is a way
    > for vlookup to ignore the leading zero's that will work too.
    >
    > Thanks!
    >
    > Squeaky


  3. #3
    Squeaky
    Guest

    RE: Another Zero problem...

    Hi Kevin,

    Thanks for the quick response. I tried that formula but it erases all
    zero's, not just the leading ones.

    "Kevin B" wrote:

    > You can use the SUBSTITUTE formula to substitute all zeroes with an empty
    > string.
    >
    > =SUBSTITUTE(A1,0,"")
    >
    > Where A1 is the cell containing your part number
    > 0 is the character you want to replace
    > and "" is what you want to replace the zero with
    > --
    > Kevin Backmann
    >
    >
    > "Squeaky" wrote:
    >
    > > I need to remove all the leading zeros from a part number column on my
    > > spreadsheet by formula in an adjacent column. There can be none or up to 4
    > > zeros at the beginning, and some entries are alpha-numeric. (So multiplying
    > > by 1 or adding 0 won't work.) The problem comes when trying to perform a
    > > vlookup. If I don't enter the zero's, I get a "not found". If there is a way
    > > for vlookup to ignore the leading zero's that will work too.
    > >
    > > Thanks!
    > >
    > > Squeaky


  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Try this

    =RIGHT(A1,LEN(A1)-FIND(LEFT(SUBSTITUTE(A1,0,"")),A1)+1)

  5. #5
    vezerid
    Guest

    Re: Another Zero problem...

    Squeaky,

    the following formula will return the cell excluding the leading 0's. I
    took in mind your statement that there will be at most 4 0's (hence the
    1:4)

    =MID(A2,MIN(IF(MID(A2,ROW(1:4),1)="0",ROW(1:4))),LEN(A2))

    It is an array formula, hence it should be committed with
    Shift+Ctrl+Enter.

    HTH
    Kostis Vezerides


  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Quote Originally Posted by daddylonglegs
    Try this

    =RIGHT(A1,LEN(A1)-FIND(LEFT(SUBSTITUTE(A1,0,"")),A1)+1)
    ...or even

    =MID(A1,FIND(LEFT(SUBSTITUTE(A1,0,"")),A1),255)

    removes any number of leading zeroes

  7. #7
    Squeaky
    Guest

    RE: Another Zero problem...

    I got the two from daddyLL to work, had some trouble with the 3rd one, not
    sure why. I had solved it by using nestled IF functions to look for a leading
    zero multiple times, but I will use daddyLL's second suggestion.

    Thanks for all the help!

    Squeaky

    "Squeaky" wrote:

    > I need to remove all the leading zeros from a part number column on my
    > spreadsheet by formula in an adjacent column. There can be none or up to 4
    > zeros at the beginning, and some entries are alpha-numeric. (So multiplying
    > by 1 or adding 0 won't work.) The problem comes when trying to perform a
    > vlookup. If I don't enter the zero's, I get a "not found". If there is a way
    > for vlookup to ignore the leading zero's that will work too.
    >
    > Thanks!
    >
    > Squeaky


+ 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