+ Reply to Thread
Results 1 to 7 of 7

Search for numbers in a cell that also contains text

  1. #1
    Registered User
    Join Date
    11-20-2003
    Posts
    18

    Search for numbers in a cell that also contains text

    Hi guys,

    I can't solve a problem. I need to search for 2 numbers in a cell contains both
    text and numbers.

    I need to find the two first numbers after the letters,
    example:
    BFT01777 need to return "01" (three letters in the start)
    BF018888 need to return "01" also (but now two letters in the start).

    Is this possible?

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Phoenix
    Hi guys,

    I can't solve a problem. I need to search for 2 numbers in a cell contains both
    text and numbers.

    I need to find the two first numbers after the letters,
    example:
    BFT01777 need to return "01" (three letters in the start)
    BF018888 need to return "01" also (but now two letters in the start).

    Is this possible?
    Hi,

    if the two forms shown are the only formats then

    =IF(ISNUMBER(MID(A1,3,1)+0),MID(A1,3,2),MID(A1,4,2))

    should do that.

    ---
    Si fractum non sit, noli id reficere.

  3. #3
    Registered User
    Join Date
    11-20-2003
    Posts
    18
    Thanx, it works with two letters in the start, but not three.
    What if there also are 4 letters in the beginning?


    Quote Originally Posted by Bryan Hessey
    Hi,

    if the two forms shown are the only formats then

    =IF(ISNUMBER(MID(A1,3,1)+0),MID(A1,3,2),MID(A1,4,2))

    should do that.

    ---

  4. #4
    Registered User
    Join Date
    11-20-2003
    Posts
    18
    Sorry Bryan, it works perfect with three letters too :-)

    Quote Originally Posted by Bryan Hessey
    Hi,

    if the two forms shown are the only formats then

    =IF(ISNUMBER(MID(A1,3,1)+0),MID(A1,3,2),MID(A1,4,2))

    should do that.

    ---

  5. #5
    Registered User
    Join Date
    11-20-2003
    Posts
    18
    but the IF formula does not work with 4 letters. How can that be solved?

  6. #6
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Phoenix
    but the IF formula does not work with 4 letters. How can that be solved?
    4 what letters? - would you care to explain
    ---
    if you mean 4 letters preceeding the number then

    =IF(ISNUMBER(MID(A1,3,1)+0),MID(A1,3,2),IF(ISNUMBER(MID(A1,4,1)+0),MID(A1,4,2),IF(ISNUMBER(MID(A1,5,1)+0),MID(A1,5,2),MID(A1,6,2))))

    and add new 'If' as required

    ---
    Last edited by Bryan Hessey; 05-03-2007 at 06:29 AM.

  7. #7
    Registered User
    Join Date
    11-20-2003
    Posts
    18
    I see. Thanx for all the help, Bryan

    Quote Originally Posted by Bryan Hessey
    4 what letters? - would you care to explain
    ---
    if you mean 4 letters preceeding the number then

    =IF(ISNUMBER(MID(A1,3,1)+0),MID(A1,3,2),IF(ISNUMBER(MID(A1,4,1)+0),MID(A1,4,2),IF(ISNUMBER(MID(A1,5,1)+0),MID(A1,5,2),MID(A1,6,2))))

    and add new 'If' as required

    ---

+ 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