+ Reply to Thread
Results 1 to 5 of 5

Find a phrase

  1. #1
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Find a phrase

    Hi I've attached an example document to make this easier.

    In sheet one column B I have a rows of text. In sheet 2 I have two tables with different sets of phrases.

    What I would like to do is have row C on sheet 1 to look and see if the text in column B matches either of the tables on sheet 2 and output either 1 or 2 to represent which table it was found in. If the text is found in both tables then the output should be 2. If only part of the phrase in col b in found in either table then output should be 0.

    I've put some example in the attached doc.

    Cheers

    Dave
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Find a phrase

    Your description of the problem is the wrong round.

    "..row C on sheet 1 to...see if the text in column B matches either of the tables on sheet 2"

    There is NO row C, there is however a Column C.
    NONE of the rows on Sheet1 column B "...matches either of the tables on sheet 2"

    What's happening is the text in the tables on Sheet 2 match SOME of the text on Sheet1 Column B
    Therefore your output should be on Sheet 2 for each table not on Sheet 1.

    Can you work with the output on Sheet 2 instead of Sheet 1 ?
    Last edited by Special-K; 12-19-2018 at 11:45 AM.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Find a phrase

    Hi,

    a first approach: the two outcome table ranges cannot house blank cells. Otherwise you have to reduce ranges read by SEARCH (the red numbers).

    =MAX(ISNUMBER(LOOKUP(-1,-SEARCH(TRIM(Sheet2!E$7:E$31),B9)))*2,ISNUMBER(LOOKUP(-1,-SEARCH(TRIM(Sheet2!B$7:B$31),B9)))))

    Regards

    Edit: sorry Special-K did not mean to overlap. I'm a very slow writer.
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  4. #4
    Forum Contributor
    Join Date
    01-21-2017
    Location
    England
    MS-Off Ver
    2007
    Posts
    409

    Re: Find a phrase

    Quote Originally Posted by canapone View Post
    Hi,

    a first approach: the two outcome table ranges cannot house blank cells. Otherwise you have to reduce ranges read by SEARCH (the red numbers).

    =MAX(ISNUMBER(LOOKUP(-1,-SEARCH(TRIM(Sheet2!E$7:E$31),B9)))*2,ISNUMBER(LOOKUP(-1,-SEARCH(TRIM(Sheet2!B$7:B$31),B9)))))

    Regards

    Edit: sorry Special-K did not mean to overlap. I'm a very slow writer.
    Hi that's perfect, I won't be adding a lot of phrases so I will just increase the ranges to the amount I need.

    Many thanks

    Thank you as well Special K.

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Find a phrase

    Another method

    C9 press Ctrl+Shift+Enter copy down

    =IF(B9="","",IFERROR(MATCH(1,-1/MMULT(TRANSPOSE(ROW(Sheet2!$E$7:$E$31)),IFERROR(SEARCH(TRIM(CHOOSE({1,2},Sheet2!$B$7:$B$31,Sheet2!$E$7:$E$31)),B9),))),))
    Attached Files Attached Files

+ 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. How to find what row a phrase is in
    By mumair in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2017, 12:17 PM
  2. [SOLVED] Macro to find exact phrase
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2015, 01:26 PM
  3. Find Value Then Put Phrase in Adjacent Cell
    By TStanwood in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-08-2013, 04:11 PM
  4. Find phrase and erase all other words
    By csch123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-18-2012, 02:07 PM
  5. IF formula to find a word but Not find a certain phrase
    By byrdjulie in forum Excel General
    Replies: 2
    Last Post: 02-03-2011, 05:18 AM
  6. Replies: 1
    Last Post: 01-31-2006, 06:25 PM
  7. [SOLVED] Is there a formula to find one phrase in a selection?
    By Tiff1618 in forum Excel General
    Replies: 4
    Last Post: 09-02-2005, 09:05 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