+ Reply to Thread
Results 1 to 3 of 3

Searching Through a String for Position of 1st Non-Zero digit

Hybrid View

  1. #1
    Registered User
    Join Date
    02-20-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Searching Through a String for Position of 1st Non-Zero digit

    I have a text string in a cell, something like:

    000024AC1011.

    I need to find a way to find the first nonzero character in the string, and what position it is in. For instance, in the above example, 2 is the first non-zero character, so the function would return 5, since the 2 is the fifth character into the string.

    I'm stumped on this one! Please help!
    Thanks so much!
    Last edited by python023; 09-01-2009 at 09:33 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Searching Through a String

    Try:

    =LEFT(SUBSTITUTE(A1,0,""))+0

    where A1 has original number..

    Sorry above retrieves the digit, but to get position:

    =FIND(MID(SUBSTITUTE(A1,0,""),2,1),A1)-1
    Last edited by NBVC; 09-01-2009 at 09:19 PM. Reason: add position formula
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    02-20-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Searching Through a String for Position of 1st Non-Zero digit

    Thank you so much!

+ 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