+ Reply to Thread
Results 1 to 8 of 8

Change a cells colour, based on cond format cells in another range, of several colours

  1. #1
    Registered User
    Join Date
    08-05-2012
    Location
    England
    MS-Off Ver
    MS Office 365 Business
    Posts
    11

    Change a cells colour, based on cond format cells in another range, of several colours

    Hello, thank you for looking. Apologies if this has already been addressed recently; I skimmed through as many titles as I could, but I couldn't see anything that looked similar.

    I am assuming that what I want (if it is even possible!) will have to be done via VBA and I am a complete novice in this respect.

    I have a spreadsheet (basic example attached) which contains conditional formatting from B1:G9 to highlight the cells a certain colour, based on their value within.

    I want column A for each corresponding line to colour depending on another colour in its row, with red taking precedence, then orange, then green.

    I.E, if there are all/any red cells in any given row between B&G, that line's cell A should turn red. If there are no red, but only orange, or orange and green (line 4 for example), then A should turn orange. If there are only green, it turns green.

    Thank you in anticipation!
    Attached Files Attached Files
    Last edited by Posthuman; 10-02-2023 at 04:14 AM.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Change a cells colour, based on cond format cells in another range, of several colours

    What if using cond formatting only?
    with column A:
    1- set default color = "green"
    2- for "red":
    =OR(B1:G1>5)
    Stick "Stop if true"
    2- for "orange":
    =OR(B1:G1=5)
    Stick "Stop if true"
    Attached Images Attached Images
    Quang PT

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,446

    Re: Change a cells colour, based on cond format cells in another range, of several colours

    You could use similar conditions but use MAX.

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


    In CF, use separate conditions for each colour.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    08-05-2012
    Location
    England
    MS-Off Ver
    MS Office 365 Business
    Posts
    11

    Re: Change a cells colour, based on cond format cells in another range, of several colours

    Thank you both so so much for the quick responses. These work perfectly for the example I gave!

    I have a second sheet set up very similar however, the data within the cells are dates. If the date = today or later (future), the cell is red. If it is -60 days prior to today, it's orange and if it is 61 or more days prior, it's green.

    Do you know if there is there a way to modify either of your methods to adapt it to this? I just can't figure it out.

    I have tried using the Cell Value > "Between" function in the CF menu, however, it seems to convert the dates to random numbers and just basically highlights everything.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,446

    Re: Change a cells colour, based on cond format cells in another range, of several colours

    Please post a new sample with the date based data.

  6. #6
    Registered User
    Join Date
    08-05-2012
    Location
    England
    MS-Off Ver
    MS Office 365 Business
    Posts
    11

    Re: Change a cells colour, based on cond format cells in another range, of several colours

    Apologies! Second sheet attached.

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Change a cells colour, based on cond format cells in another range, of several colours

    Formula in C4 (shorter):
    Please Login or Register  to view this content.
    Below three Cond Formating formula, in order, with "Stop If True" box is checked
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-05-2012
    Location
    England
    MS-Off Ver
    MS Office 365 Business
    Posts
    11

    Re: Change a cells colour, based on cond format cells in another range, of several colours

    Hi Bebo021999, thank you for the response. It's not quite what I was looking for but I really appreciate you taking the time to look at it and have a go. You're clearly very knowledgable on excel formulas!

+ 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. [SOLVED] VBA to Cond Format cells in column CX6:C based on CX7 being equal to CX6. Apply CF to CX7.
    By A440 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-04-2021, 08:04 AM
  2. Replies: 9
    Last Post: 12-08-2020, 04:15 PM
  3. Colour Duplicates in Range of Cells in different colours
    By Dan_B in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-29-2017, 07:33 AM
  4. Replies: 1
    Last Post: 11-01-2012, 11:38 PM
  5. [SOLVED] change colour of cells (more than 3 colours)
    By Mrs T in forum Excel General
    Replies: 20
    Last Post: 07-29-2012, 12:04 PM
  6. [SOLVED] Loop Sheets and set Cond. Format to a Range of Cells?
    By Hood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2012, 09:58 AM
  7. [SOLVED] Format colour of cells based on other cell - 34 colours
    By Graham Tritton in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2006, 10:10 PM

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