+ Reply to Thread
Results 1 to 3 of 3

Searching for data string in list of numbers

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

    Searching for data string in list of numbers

    Hope the title wasn't unclear.

    I have a list of numbers in column A (3 and 4 -digit numbers).
    In column C (say in C2)I have a a string to test against column A.
    I would all the values in A that meet the string test to be reported in column E.

    Example
    column A
    3408
    116
    9142
    063
    5127


    Test string in Column C is 125679

    It would report in Column E
    116
    5127

    because only these two values meet the test--ie they are comprised of digits from the test string and only from the test string. In other words a number in column A is reported if and only of its digits are made up from the test string in column C

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Searching for data string in list of numbers

    With 125679 in C1, in B1 enter and copy down,

    =IF(AND(ISNUMBER(FIND(MID(A1, {1,2,3,4}, 1), $C$1 & ""))), A1, "")
    Entia non sunt multiplicanda sine necessitate

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

    Re: Searching for data string in list of numbers

    Further, if you want to list those matches in a new column without blanks..

    Then start in row 2, and change shg's formula in B2 to:

    =IF(AND(ISNUMBER(FIND(MID(A2, {1,2,3,4}, 1), $C$2 & ""))), COUNT($B$1:B1)+1, "")

    and copy down.. where C2 contains your search string.

    then in C3 enter:

    =MAX(C:C)

    and in E2:

    =IF(ROWS($A$1:$A1)>$C$3,"",INDEX(A:A,MATCH(ROWS($A$1:$A1),B:B,0)))

    copied down as far as you want.
    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