+ Reply to Thread
Results 1 to 10 of 10

Find any one of a list of terms, in a single string of terms

  1. #1
    Registered User
    Join Date
    11-02-2010
    Location
    Denver, Co, USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Find any one of a list of terms, in a single string of terms

    I have a long list of websites and I want to know if any of them fall within a single complicated url. So is there a function where I can ask something like... are any of these items in this list, in this single complicated string? I can't parse the url's as they are not all www.etc...

    Thanks,

    Brad
    Last edited by NBVC; 11-03-2010 at 12:06 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Find any one of a list of terms, in a single string of terms

    1) list all the urls in column A
    2) list the search strings in column B
    3) in C1 put this formula and then copy down:

    =ISNUMBER(MATCH("*" & B1 & "*",$A:$A, 0))

    You will get a series of TRUE/FALSE answers for the items that match.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

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

    Re: Find any one of a list of terms, in a single string of terms

    If your list of websites is in column A and the sections you want are in column B (say B1:B3), then try:

    =SUMPRODUCT(--ISNUMBER(SEARCH($B$1:$B$3,A1)))>1

    to get TRUE if match found.

    if you want to know which part was matched:

    =SUMPRODUCT(--ISNUMBER(SEARCH($B$1:$B$3,A1)),ROW($B$1:$B$3)-ROW($B$1)+1)

    will give you the item number from B1:B3 that matched.
    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.

  4. #4
    Registered User
    Join Date
    11-02-2010
    Location
    Denver, Co, USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Find any one of a list of terms, in a single string of terms

    Hey guys, thanks for your quick replies. I think I may have miscommunicated my problem. I am attaching a test file that shows what I'm hoping for. Thanks in advance if you can help me with this!

    Brad
    Attached Files Attached Files

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

    Re: Find any one of a list of terms, in a single string of terms

    Try:

    =SUMPRODUCT(--ISNUMBER(SEARCH($F$2:$F$8,A2)))>=1

    copied down... I had forgotten the = in >= before....

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

    Re: Find any one of a list of terms, in a single string of terms

    try in b2
    =LOOKUP(2^99,SEARCH($F$2:$F$8,A6))>0
    or
    =NOT(ISNA(LOOKUP(2^99,SEARCH($F$2:$F$8,A2))))
    Last edited by martindwilson; 11-02-2010 at 05:16 PM.
    "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

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

    Re: Find any one of a list of terms, in a single string of terms

    the first one, martin, doesn't work correctly....

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Find any one of a list of terms, in a single string of terms

    Based on my original suggestion, put this in D2 and press CTRL-SHIFT-ENTER to confirm it and activate the array:

    =OR(ISNUMBER(MATCH("*" & $F$2:$F$8 & "*", A2, 0)))

    ...or

    =OR(ISNUMBER(SEARCH("*" & $F$2:$F$8 & "*", A2)))
    Last edited by JBeaucaire; 11-02-2010 at 05:25 PM.

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

    Re: Find any one of a list of terms, in a single string of terms

    oops a2 not a6
    =LOOKUP(2^99,SEARCH($F$2:$F$8,A2))>0
    =NOT(ISNA(LOOKUP(2^99,SEARCH($F$2:$F$8,A2)))) and i suppose its in D2
    Attached Files Attached Files
    Last edited by martindwilson; 11-02-2010 at 05:35 PM.

  10. #10
    Registered User
    Join Date
    11-02-2010
    Location
    Denver, Co, USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Find any one of a list of terms, in a single string of terms

    Thank you NBVC, your solution is going to save me countless hours of work! Thank you to everyone else who contributed. I have another thread here http://www.excelforum.com/excel-gene...ml#post2411892 where I am trying to figure out how to "remotely" control a pivot filter, in 2007. Hope you guys can help!?

    Thanks,

    Brad

+ 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