+ Reply to Thread
Results 1 to 6 of 6

Search and highlight hits only in Column C

  1. #1
    Registered User
    Join Date
    02-16-2005
    Location
    Oklahoma City
    MS-Off Ver
    Office 365
    Posts
    56

    Search and highlight hits only in Column C

    In an Excel 2010 worksheet I use three columns. I need a user to be able to input a word or phrase into a cell or input box, and have Excel highlight that word or phrase every place it occurs only in column C.

    Can I do that with conditional formatting? Or do I need to use a function? Or do I need a macro? I've tried Googling and can't find a good solution.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Search and highlight hits only in Column C

    If you only wanted to highlight the word or phrase (from within other text in the cell(s) ) then you would need a macro, and then it would have to be the foreground colour which is changed, as conditional formatting can only highlight a complete cell and background colours can only apply to a complete cell in Excel.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    02-16-2005
    Location
    Oklahoma City
    MS-Off Ver
    Office 365
    Posts
    56

    Re: Search and highlight hits only in Column C

    Thank you Pete_UK. Does anyone have a suggestion for a macro that does the following:
    1. Prompts the user for a word or phrase.
    2. Searches only column C for the word or phrase.
    3. Highlights in red all occurrances of the word or phrase in column C.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Search and highlight hits only in Column C

    The attached file shows how something similar can be achieved with conditional formatting. Enter a keyword or phrase in cell K1 (yellow), and if it is found in column C the whole cell is highlighted. The CF condition in cell C2 is:

    =ISNUMBER(FIND($K$1,C2))

    which makes it case-sensitive (try "the" and "The" in K1). If case is not important then you can change FIND to SEARCH.

    Hope this helps.

    Pete
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search and highlight hits only in Column C

    I used Pete's sheet as sample and searched for "test".
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-16-2005
    Location
    Oklahoma City
    MS-Off Ver
    Office 365
    Posts
    56

    Re: Search and highlight hits only in Column C

    The person in charge of this project just changed the requirements. (Ugh!) Now it has to work like this:
    1. The user enters a keystroke (perhaps ctrl+alt+s) to bring up an input box.
    2. The user enters a word or phrase into the input box and submits it.
    3. Excel does a non-case-sensitive search in column C for the word or phrase. (Words and phrases in column C are separated with commas.)
    4. For every occurrence of the word or phrase in column C, excel highlights in yellow the cells in columns A, B, and C of that row.

    For example, in the attached workbook if the user searches the "Medical" worksheet for "MED5" and "med5" is found in C2 and C4, then cells A2:C2 and A4:C4 would be highlighted in yellow.

    This will obviously require a custom macro and I'm not a VBA programmer. Does anyone have a similar macro?
    Attached Files Attached Files
    Last edited by kenelder; 06-12-2013 at 12:10 PM.

+ 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