+ Reply to Thread
Results 1 to 5 of 5

Excel 2003: How to conditional format if cell contains any of a list of keywords

  1. #1
    Registered User
    Join Date
    11-08-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    2

    Excel 2003: How to conditional format if cell contains any of a list of keywords

    Hi,

    I've been able to find answers to dozens of questions in this forum that have helped me hugely, which I'm extremely grateful for, but I've come unstuck with this one....

    I have a workbook split into two sheets - 'Data' and 'Keywords'.

    The 'Data' sheet consists of a range of cells ($A$2:$AE$100), some of which contain numbers, some contain text strings, some a mixture of both (I don't know if that's relevant or not).

    In the 'Keywords' sheet I have a list (from A2:A50) of keywords for positive sentiments, e.g. happy, brilliant, first class, at ease, outstanding etc. etc.
    If it helps, I've defined this list as a name ("Keywords")

    I'd like to apply a conditional format to cells $A$2:$AE$100 in 'Data', so that if any of those cells contain any of the keywords, the font colour in that cell changes to red.

    e.g. If B2 contains the string "I AM HAPPY TODAY", and C3 contains the string "I AM SAD TODAY", all text in cell B2 would change to red font as it contains one of the keywords (happy), whereas the font colour of cell C3 would remain as is.

    I'm open to using VBA if it'd be more appropriate than conditional formatting

    Any help would be greatly appreciated.

    Thank you

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Excel 2003: How to conditional format if cell contains any of a list of keywords

    HI DoubleFour,

    Welcome to the forum.

    See the attached workbook where I have used below formula in a column next to keywords:-

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    After this, have used a simple match function in the conditional formatting logic to achieve the desired results... let me know if you need further explanation on any point. Thanks.

    CF if cell contains any keyword.xlsx


    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Excel 2003: How to conditional format if cell contains any of a list of keywords

    Using your posted scenario....
    • Select the range of cells that will have Conditional Formatting, with A2 as the active cell
    • Format.Conditional_formatting
    ...Condition_1: Formula is: =COUNT(SEARCH(" "&Keywords&" "," "&A2&" "))
    ...Click: Format...set the conditional format you want
    ...Click: OK...Click: OK

    That will apply the CF to cells that contain stand-alone keywords .
    Example:
    Highlight "I am happy"
    but, not "I am unhappy"

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    11-08-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    2

    Talking Re: Excel 2003: How to conditional format if cell contains any of a list of keywords

    To DILIPandey and Ron,

    thank you both for taking the time to look at this problem and offer your solutions, both work absolutely as I needed.

    I've implemented Ron's solution purely as I found it the more "simple" of the two, and I am a very simple person!

    Thank you once again - stars well & truly deserved to both

  5. #5
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Excel 2003: How to conditional format if cell contains any of a list of keywords

    You are welcome doublefour...

    Thanks for the REP

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

+ 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