+ Reply to Thread
Results 1 to 6 of 6

Apply Formatting if Any of These Words are Present

  1. #1
    Registered User
    Join Date
    04-29-2013
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2010
    Posts
    50

    Apply Formatting if Any of These Words are Present

    Hi. My issue seems simple enough, but not for me, so thanksalot for reading.

    Column A has 200 names.

    I want the names John, Tom, George, Frank and BillyBob to be filled with blue.

    I want the names Sally, Mary, Kathy and Gertrude to be filled with pink.

    I want the names Ebenezer, Vader and Fagin to be filled with black...and so on.



    Thanks in advance. JS

  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,791

    Re: Apply Formatting if Any of These Words are Present

    Select all the cells, starting from A1, then click on Conditional Formatting, New Rule, then choose "Use a formula ..." from the bottom of the list. Put this formula in the formula box:

    =ISNUMBER(MATCH(A1,{"John","Tom","George","Frank","BillyBob"},0))

    then click the Format button, Fill tab and choose blue. OK your way out.

    Then repeat for the other conditions, changing the names in the formula to suit and choosing the appropriate colour.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    04-29-2013
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2010
    Posts
    50

    Lightbulb Re: Apply Formatting if Any of These Words are Present

    Pete, thanks for your help. I created a new workbook to test the fix suggested. I received the following error message:

    "You may not use reference operators (such as unions, intersections, and ranges)or array constraints for Conditional Formatting criteria."

    Sounds like a train wreck to me, but I don't know anything about trains or excel. I doubled-checked by copying and pasting the formula exactly with no luck.

    Any suggestions? Thanks again, Pete!

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Apply Formatting if Any of These Words are Present

    The part in curly braces is an "array constant" and can't be used in conditional formatting, either try using OR like this

    =OR(A1="John",A1="Tom",A1="George",A1="Frank",A1="BillyBob")

    or create a named range of those names called NameList and use

    =MATCH(A1,Namelist,0)
    Audere est facere

  5. #5
    Registered User
    Join Date
    04-29-2013
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Apply Formatting if Any of These Words are Present

    daddylonglegs! Solution 1 worked like a big dog! (I will also try your second recommedation for other lists.)

    Thanks for your help. Pete, thanks to you also.

    My English friends helped me out of a big jam. Cheers!
    Last edited by ThanksAlot; 04-29-2013 at 11:05 AM. Reason: spelling

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

    Re: Apply Formatting if Any of These Words are Present

    Glad to be able to help. Setting up named ranges for your names would be more flexible if you wanted to change any of the names in future. Set up named ranges called "names_1", "names_2" etc and then your CF formulae would be:

    =ISNUMBER(MATCH(A1,names_1,0)) ---> blue

    =ISNUMBER(MATCH(A1,names_2,0)) ---> pink

    and so on.

    Hope this helps.

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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