+ Reply to Thread
Results 1 to 10 of 10

IF statement formula trying to pull numbers that vary in # of digits

  1. #1
    Forum Contributor
    Join Date
    06-27-2012
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    164

    Lightbulb IF statement formula trying to pull numbers that vary in # of digits

    I can't explain this properly. I am trying to pull from a text string numbers but these numbers vary in the # of digits what formula can i use. I tried this formula and it gives me a false result. Please help.

    jane doe 123456 formula to pull "123456" = if(right(a1,6))

    clause 123 formula to pull "123456" = if(right(a1,3)


    how can I make a standard formula that will pull all possibilities ? thanks
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: IF statement formula trying to pull numbers that vary in # of digits

    Try
    =RIGHT(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),LEN(A2))+0

  3. #3
    Forum Contributor
    Join Date
    06-27-2012
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    164

    Re: IF statement formula trying to pull numbers that vary in # of digits

    Great ! this actually worked but I also have some items that are like this

    SamJones85467 with no space .what can I add to this formula to pull just the last 5 numbers?

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: IF statement formula trying to pull numbers that vary in # of digits

    Try this, assuming there will be no other numbers in the string prior to the zip.

    =MID(A2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A2&"0123456789")),LEN(A2))+0

  5. #5
    Forum Contributor
    Join Date
    06-27-2012
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    164

    Re: IF statement formula trying to pull numbers that vary in # of digits

    CanaanSmith60991 result with 2nd formula 6099

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: IF statement formula trying to pull numbers that vary in # of digits

    works for me on all examples you posted
    EFdjmatok.xlsx

  7. #7
    Forum Contributor
    Join Date
    06-27-2012
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    164

    Re: IF statement formula trying to pull numbers that vary in # of digits

    Hey Jonmo,
    I would like to ammend the original formula that you gave me =RIGHT(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),LEN(A2))+0 and be able to pick up also anythign withought a space. The new formula that you gave me will not pick up the different variations ..

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: IF statement formula trying to pull numbers that vary in # of digits

    Sorry, it does for me.

    I can't ammend the first formula to account for a cell without spaces.
    The 2nd formula accounts for a cell without spaces.
    It basically looks for the first number in the cell, and returns everything from that point on.

    Post a new workbook with samples of ALL possible scenarios of your data.

  9. #9
    Forum Contributor
    Join Date
    06-27-2012
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    164

    Re: IF statement formula trying to pull numbers that vary in # of digits

    Perfect!!! Now it works I did not change the cell reference properly. THank you!!!!!!!!

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: IF statement formula trying to pull numbers that vary in # of digits

    You're welcome.

+ 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