+ Reply to Thread
Results 1 to 4 of 4

Seaching for 2 digits from a string against a list of numbers

  1. #1
    Registered User
    Join Date
    03-01-2010
    Location
    new york, usa
    MS-Off Ver
    Excel 2003
    Posts
    37

    Seaching for 2 digits from a string against a list of numbers

    I have a list of numbers in One column, say Column A
    In another column, say Column C I have s string ---3, 4, 5, 6, 7,or 8 digits long.

    I want to identify all values in Column A that have 2 digits ONLY from the string.

    Example
    Column A
    511
    060
    516
    098
    124
    700
    236
    464

    Column C (the string to be tested)
    013689

    Results shown in Column B
    060
    516
    236


    Notice that 098 does not qualify because all 3 digits are in the string. We only need those numbers that have 2 digits from the string.
    Last edited by Sweetypie; 05-04-2010 at 12:03 AM.

  2. #2
    Registered User
    Join Date
    03-01-2010
    Location
    new york, usa
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Seaching for 2 digits from a string against a list of numbers

    Quote Originally Posted by NBVC View Post
    Why is 060 an acceptable result if the 0 is repeated... and not 700 or 511?
    Thanks for reply. I should have anticipated that question. I am looking to identify 2 different digits from the string. So 060 is comprised of 2 different digits from the string even though 1 digit is repeated.

    511 has only 1 of the relevant digits even though that 1 digit is repeated.

    Hope it can be done.

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Seaching for 2 digits from a string against a list of numbers

    this works for your sample but only if no digits repeated in your string in c(well it's in b1 of this)
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

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

    Re: Seaching for 2 digits from a string against a list of numbers

    As long as you are consistently looking at 3-digit codes, then perhaps with 1 helper column...

    Also, start the codes in row 2, so in B2 enter:

    Please Login or Register  to view this content.
    copied down.. where C1 contains the 013689 number.

    then in C2:

    Please Login or Register  to view this content.
    copied down as far as necessary.


    Adjust all ranges to suit.
    Attached Files Attached Files
    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.

+ 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