+ Reply to Thread
Results 1 to 8 of 8

Look for a list of strings in sentence and if found, return a value

  1. #1
    Registered User
    Join Date
    10-24-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    3

    Smile Look for a list of strings in sentence and if found, return a value

    Hi guys,

    New joiner here, but I have been following the forum for about 2 weeks now.

    I am getting a dead end in solving the excel function that would be able to help me in achieving the outcome that I wanted.

    It is basically finding for a set of strings in sentence and if found, return a value.

    To visualise it:

    Sentence (to be scanned)
    xxx AAA ppp
    yyy AAA
    zz BB pp qq
    zz CC pp
    zz 99 pp
    xpo CC xpo

    Strings (to look for)
    AAA
    BB

    Result
    Found
    Found
    Found
    Not Found
    Not Found
    Not Found

    The column "Result" is the outcome that need to be achieved. For each cell in "Sentence", scan if any of the value in "Strings" exist. If it exist, return Found, else Not Found.

    Thank you in advance.
    Last edited by chemisiq; 10-25-2013 at 07:50 AM.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Look for a list of strings in sentence and if found, return a value

    Hi,

    Assuming your list of sentences and list of search strings are in A2:A7 and D2:D3 respectively, and that you would like cases such as Sentence: zz AAAA pp; String: AAA to be considered as "Not Found", enter this formula in B2 and copy down as required:

    =IF(SUMPRODUCT(--(ISNUMBER(SEARCH("|"&$D$2:$D$3&"|","|"&SUBSTITUTE(A2," ","|")&"|")))),"Found","Not Found")

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  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: Look for a list of strings in sentence and if found, return a value

    with strings starting a1 and list in d1:d2
    in b1 filled down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    "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
    Registered User
    Join Date
    10-24-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Look for a list of strings in sentence and if found, return a value

    Hi all, thank you for the help. Perhaps I should have been more clearer in defining the column "Sentence". Sorry for that.

    Column "Sentence" does not really have a similar pattern, but rather it consist of sentences and the value to be look for can be found anywhere within the sentence.

    Sentence (to be scanned)
    xAAA xx ppp
    yyy AAA
    BB zz pp qq
    zz pp CC
    z99z pp
    xCC po xpo
    yyyxxxxxxxyieuAAAppppo
    yyy xxxxxxx yieu AAA ppppo

    Is there a way to utilise the formulae that have been defined by martin and XOR, and somehow modify it to be able to check "Sentence"?

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Look for a list of strings in sentence and if found, return a value

    Not sure I follow. The formula I gave you and copied down matches precisely your desired results as given in your first post.

    Regards

  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: Look for a list of strings in sentence and if found, return a value

    yyyxxxxxxxyieuAAAppppo
    yyy xxxxxxx yieu AAA ppppo

    would both those match aaa?
    Last edited by martindwilson; 10-24-2013 at 12:33 PM.

  7. #7
    Registered User
    Join Date
    10-24-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Look for a list of strings in sentence and if found, return a value

    Thanks Martin and XOR for the help....this problem is now solved!!

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Look for a list of strings in sentence and if found, return a value

    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)

Similar Threads

  1. [SOLVED] Look for a list of keywords in a cell and then return the content of the found cell
    By RasmusClark in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-10-2013, 04:50 AM
  2. excel formula to search Multiple strings in several columns and return strings
    By krratna123 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-13-2013, 11:20 AM
  3. Replies: 1
    Last Post: 08-13-2013, 08:32 AM
  4. Skakes in the Summer
    By lowryda777 in forum Excel General
    Replies: 2
    Last Post: 06-27-2012, 10:29 AM
  5. How to find number of pairs of strings from list of strings?
    By greg_overholt in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-27-2006, 06:45 PM

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