+ Reply to Thread
Results 1 to 4 of 4

Search for words in a cell, from a list. Pull those words that are there out and list them

Hybrid View

  1. #1
    Registered User
    Join Date
    07-18-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    2

    Question Search for words in a cell, from a list. Pull those words that are there out and list them

    Hi Guys

    Been thinking for a while on how to pull this off... I need a formula that would search a column of descriptions from a big list of keywords and phrases. And if some of those words are found, then they are pulled from said description to be listed as a string of words set out with comers instead of spaces. But ignoring the words that are not found.

    So far i have tried to use both of these formulas:

    =IF(SEARCH("WORD1",$A$1:$A$10),"WORD1") &","&IF(SEARCH("WORD2",$A$1:$A$10),"WORD2")&","&IF(ISERR(SEARCH("WORD3",$A$1:$A$9)),"WORD3") Etc....

    Using this formula it finds 'WORD1' and 'WORD3' (which are in the description) but not 'WORD2' ending up with having the result of:

    #VALUE!


    Or using this formula:

    =IF(ISERR(SEARCH("WORD1",$A$1:$A$9)),"WORD1") &","&IF(ISERR(SEARCH("WORD2",$A$1:$A$9)),"WORD2") &","&IF(ISERR(SEARCH("WORD3",$A$1:$A$9)),"WORD3") Etc....

    This formula gets me closer to what i want as 'WORD1' and 'WORD3' are in the description and 'WORD2' isnt. But this results in:

    'FALSE,FALSE,WORD2'

    Which is the reverse of what i want. What i would like would be the outcome to be 'WORD1,FALSE' and then just delete all 'FALSE' words.


    Hope that someone get help me out!

    Thanks.

  2. #2
    Registered User
    Join Date
    06-22-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    65

    Re: Search for words in a cell, from a list. Pull those words that are there out and list

    Folay,

    Try this:

    {=IF(OR(NOT(ISERR(SEARCH("WORD1",$A$1:$A$10)))),"WORD1","")&IF(OR(NOT(ISERR(SEARCH($B2,$A$1:$A$10)))),"WORD2","")&IF(OR(NOT(ISERR(SEARCH("WORD3",$A$1:$A$10)))),"WORD3","")}

    This is an array formula <ctrl><shift><enter> which will output the words that are found. If you are not familiar with array formulas please note you do not enter the curly brackets - just input the formula and rather than pressing <enter>, press <ctrl><shift><enter> and Excel puts the curly brackets around to signify that it is an array formula.

    The NOT(ISERR(...)) returns a true, false array. The OR then produces a single true/false depending upon whether your string was found. This is then concatenated to your other searches.

    If you want to put a comma in between the words that are found then the formula would become very long given you only need a comma in certain instances, otherwise you will get ",WORD2,WORD3".

    The attached breaks down each step. I hope that helps.

    Regards

    David
    Attached Files Attached Files
    Last edited by JBeaucaire; 08-14-2013 at 10:37 AM.

  3. #3
    Registered User
    Join Date
    07-18-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Search for words in a cell, from a list. Pull those words that are there out and list

    Thanks David,

    This does help a little but i was trying to get the outcome list, WORD1,WORD2,WORD3, to just be contained to each row. Where each row has its own unique list.

    So for instance, if A1, A2 and A3 contained the sentences:

    A1 - The cat sat on the mat
    A2 - The dog sat on the stairs
    A3 - The mouse was hiding in its hole

    Then the list for them could read in column B:

    B1 - cat,sat,mat
    B2 - dog,sat,stairs
    B3 - mouse,hiding,hole

    Is there a formula that would do this so i can just drag it down and it fills everything in automatically?

    Thanks again
    Folay

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

    Re: Search for words in a cell, from a list. Pull those words that are there out and list

    This would require VBA to accomplish.
    _________________
    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!)

+ 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. Replies: 3
    Last Post: 11-28-2012, 04:00 AM
  2. Looking for VBA that will search for a list of words and add a logo if found
    By kmckie in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-29-2012, 06:48 AM
  3. search & highlight specific words from list in workbook
    By venexcel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-27-2012, 02:34 PM
  4. Replies: 1
    Last Post: 04-04-2012, 07:15 PM
  5. Search Col.A for words that contain charactrs in Col.B & list all matches adjacently
    By macemegane in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2010, 11:17 AM

Tags for this Thread

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