+ Reply to Thread
Results 1 to 16 of 16

Search for multiple words in row and return searched value if found in first cell

  1. #1
    Registered User
    Join Date
    07-31-2018
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Search for multiple words in row and return searched value if found in first cell

    Hello all,

    I am in need to search a row for a term then return the value found to to a cell.

    For instance
    Search words
    Apple
    Banana
    Strawberry
    Pear
    Watermelon

    If any cell from B2 through E2 contains one of the search words then send that search term to B1. It would be nice if more than one was found it could show more than one result

    I will have thousands of rows to search.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Search for multiple words in row and return searched value if found in first cell

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? Please don't attach a picture of one (no-one will want to re-type all your stuff before starting).

    1. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential information is removed first!!

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    07-31-2018
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Search for multiple words in row and return searched value if found in first cell

    Unfortunately due to the sensitivity of the data I cannot upload a realistic view.
    However I have made a file with 5 lines that would be similar to what we need.

    Thank you.
    Attached Files Attached Files

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Search for multiple words in row and return searched value if found in first cell

    Are you open to VBA? I surmise the multiple returns are to be concatenated in one cell?
    Dave

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Search for multiple words in row and return searched value if found in first cell

    Try this in A2:

    =IFERROR(INDEX(B2:F2,SMALL(IF(ISNUMBER(SEARCH(G$11:G$15,B2:F2)),COLUMN(B2:F2)-1),1)),"") Ctrl Shift Enter

    You haven't included the desired results so I'm guessing at what you want here.

  6. #6
    Registered User
    Join Date
    07-31-2018
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Search for multiple words in row and return searched value if found in first cell

    Quote Originally Posted by FlameRetired View Post
    Are you open to VBA? I surmise the multiple returns are to be concatenated in one cell?
    Yes VBA would be fine. Multiple returns in one line would be nice to go into one cell.

  7. #7
    Registered User
    Join Date
    07-31-2018
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Search for multiple words in row and return searched value if found in first cell

    Quote Originally Posted by 63falcondude View Post
    Try this in A2:

    =IFERROR(INDEX(B2:F2,SMALL(IF(ISNUMBER(SEARCH(G$11:G$15,B2:F2)),COLUMN(B2:F2)-1),1)),"") Ctrl Shift Enter

    You haven't included the desired results so I'm guessing at what you want here.
    This is pretty close. Thank you! The FIN came back with the whole term it found not sure if there is anything that can be done about that. It also did not show the multiple find in the same row. I am not even sure Excel can do this.

    This return quite a bit and would already save about a day of work with just this.

    I have tried to explain what is needed. I will think about how to explain it better where its understandable. However this is a HUGE help.

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Search for multiple words in row and return searched value if found in first cell

    In the attached find this formula that must be array entered.

    If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The VBA is the CONCATALL UDF. It's installed in the attached in the VBA editor. The code is not mine. It was written by tigeravatar.

    Please Login or Register  to view this content.

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Search for multiple words in row and return searched value if found in first cell

    If you should ever decide to upgrade to Office 365 (subscription) it has the function TEXTJOIN ... which desktop 2016 does not ... which does the same thing .

  10. #10
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Search for multiple words in row and return searched value if found in first cell

    You can use a formula to return all of the search words found per row.

    Try this:

    H2 =IFERROR(INDEX($B2:$F2,SMALL(IF(ISNUMBER(SEARCH($G$11:$G$15,$B2:$F2)),COLUMN($B2:$F2)-1),COLUMNS($A:A))),"") Ctrl Shift Enter
    Drag the formula to the right and down as far as needed.

    See attachment.

    I'll work on returning the search word, not the contents of the cell that the search word is in.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-31-2018
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Search for multiple words in row and return searched value if found in first cell

    Quote Originally Posted by whomewhy View Post
    This is pretty close. Thank you! The FIN came back with the whole term it found not sure if there is anything that can be done about that. It also did not show the multiple find in the same row. I am not even sure Excel can do this.

    This return quite a bit and would already save about a day of work with just this.

    I have tried to explain what is needed. I will think about how to explain it better where its understandable. However this is a HUGE help.
    In my actual excel file it is returning the multiple, just not in the test. if it finds multiple it shows name1; name2

  12. #12
    Registered User
    Join Date
    07-31-2018
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Search for multiple words in row and return searched value if found in first cell

    Quote Originally Posted by FlameRetired View Post
    If you should ever decide to upgrade to Office 365 (subscription) it has the function TEXTJOIN ... which desktop 2016 does not ... which does the same thing .
    I am actually using Office 365

  13. #13
    Registered User
    Join Date
    07-31-2018
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Search for multiple words in row and return searched value if found in first cell

    Quote Originally Posted by 63falcondude View Post
    You can use a formula to return all of the search words found per row.

    Try this:

    H2 =IFERROR(INDEX($B2:$F2,SMALL(IF(ISNUMBER(SEARCH($G$11:$G$15,$B2:$F2)),COLUMN($B2:$F2)-1),COLUMNS($A:A))),"") Ctrl Shift Enter
    Drag the formula to the right and down as far as needed.

    See attachment.

    I'll work on returning the search word, not the contents of the cell that the search word is in.
    I was not correct in my first replay. In my actual excel file it is returning the multiple finds no problem, just not in the test. if it finds multiple it shows name1; name2 with your first code. So it is just the return just the search term.

  14. #14
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Search for multiple words in row and return searched value if found in first cell

    Quote Originally Posted by whomewhy View Post
    I am actually using Office 365
    Super!!

    Please update your profile.

    Array enter this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    There is no longer a need to save as an *.xlsm (macro) file.

  15. #15
    Registered User
    Join Date
    07-31-2018
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Search for multiple words in row and return searched value if found in first cell

    Quote Originally Posted by FlameRetired View Post
    Super!!

    Please update your profile.

    Array enter this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    There is no longer a need to save as an *.xlsm (macro) file.
    Wow this did an amazing job! Where do I send the care package too? Thank you so much!

  16. #16
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Search for multiple words in row and return searched value if found in first cell

    You are welcome. Thank you for the feedback and updating your profile.

    You can send the care package to someone needy near you. Thank you for the thought.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] Search multiple phrases in a cell and return the first phrase found
    By pmeltzers in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-26-2017, 04:07 PM
  2. [SOLVED] Formula - If find 3 possible words within a cell, return the word found?
    By nobodyukno in forum Excel General
    Replies: 4
    Last Post: 03-17-2017, 01:30 PM
  3. A word search to return words found in given fields
    By JonBrett in forum Excel General
    Replies: 2
    Last Post: 03-28-2014, 10:16 PM
  4. Replies: 3
    Last Post: 01-21-2014, 05:15 PM
  5. Search cell for multiple text , return comma separated text in separate cell if found
    By dangerdoug in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-01-2013, 01:52 PM
  6. Search a cell for multiple words and return multiple results in one cell
    By samanthat86 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2013, 12:01 PM
  7. Using "Find" to return results if a word is found within multiple words in a cell
    By pylauzier in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-01-2011, 01:37 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