+ Reply to Thread
Results 1 to 6 of 6

Using "Find" to return results if a word is found within multiple words in a cell

  1. #1
    Registered User
    Join Date
    07-28-2011
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    5

    Using "Find" to return results if a word is found within multiple words in a cell

    I have working code that prompt the user to enter a word, and then it will search in a specific column to find all the cases where the word is found. When a positive result is found, the whole line gets colored.

    The code works but only if the word matches the cell content exactly.

    Example:

    Cell contains "Honey", user enters "Honey", the line will get colored.
    Cell contains "Honey, Bees", user enters "Honey", the line will get ignored.

    Here is the line of code that I think should be changed to something else, but I don't know what. I also tried to add stars (*) before and after the string that gets searched but it returned all the empty lines as positive results.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Using "Find" to return results if a word is found within multiple words in a cell

    If you look up Find in Excel help you will see that there is a lookat parameter. You need to specify that if it is defaulting to something else:
    Please Login or Register  to view this content.
    Though don't think you need code at all, you could use conditional formatting.

  3. #3
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Using "Find" to return results if a word is found within multiple words in a cell

    Try:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,252

    Re: Using "Find" to return results if a word is found within multiple words in a cell

    Try this:
    Please Login or Register  to view this content.
    Hope that helps,

    Colin

    RAD Excel Blog

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Using "Find" to return results if a word is found within multiple words in a cell

    Looks like I got "in" and "at" the wrong way round!

  6. #6
    Registered User
    Join Date
    07-28-2011
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Using "Find" to return results if a word is found within multiple words in a cell

    Thanks everyone, much appreciated. As for conditional formating, I'm building this worksheet for my computer-impaired boss and having him click somewhere and enter text without having to change anything is pretty much the most he wants to do. I'm an intern and I'm not even supposed to work with code so this should do the trick :D

+ 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