+ Reply to Thread
Results 1 to 11 of 11

Conditional Format of cells based on other cell values

  1. #1
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Conditional Format of cells based on other cell values

    Hi,

    I have a worksheet that contains 4 descriptive columns (X, Y, Z, AA) which contain text values "green", "yellow", "red" whose values correspond to 4 other columns that hold time-based values (Columns N, O, P, Q)


    What I am trying to accomplish is as follows:

    If the text value "green" appears in Col X, then the color green should be applied to Col N, else if the value "yellow" appears in Col X, then the color yellow should be applied to Col N, else if the value "red" appears in Col X, then the color red should be applied to Col N

    The same relationship described above (for Col X and N) with the same conditions exists and should be similarly applied for the following column pairs:
    Y & O (ex: so if Y4 holds the value "green", then O4 should be colored green)
    Z & P (ex: if Z4 holds the value "yellow", then P4 should be colored yellow)
    AA & Q (ex: if AA4 holds the value "red", then Q4 should be colored red)

    I've attached a workbook with a few sample rows of data, and have applied formatting by hand to the first 5 rows of data to hopefully better illustrate what I am looking to do.

    The final workbook would be several thousand rows long, and I already have a lot of macros tied to it, so I would love to be able to wrap it up with one final formatting macro.

    I would be truly grateful for any help offered.

    Thanks in advance!
    Attached Files Attached Files
    Last edited by hamidxa; 05-18-2015 at 12:44 AM.

  2. #2
    Forum Contributor
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    Version 14.4.3, Mac 2011
    Posts
    145

    Re: Conditional Format of cells based on other cell values

    Hey,
    It seems like you just need normal conditional formatting
    with a formula that says "=X4="red""
    and another rule saying "=X4="green""
    and so on.
    I'm attaching this, I'm colorblind so you may want to correct the colors! :D
    cftest.xlsx

    I don't think you need VBA at all.
    Cheers,
    Red

  3. #3
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Conditional Format of cells based on other cell values

    Hi Red,

    Thanks for sharing this approach.

    I took a similar one when going the non vba route, yet remain very interested in exploring a vba based approach.

    Would love to see if a vba macro could accomplish this more efficiently and also work with the rest of my macros.

  4. #4
    Forum Contributor
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    Version 14.4.3, Mac 2011
    Posts
    145

    Re: Conditional Format of cells based on other cell values

    Now personally, other than a macro that will set the Conditional Formats that you can initially put in by hand, an if statement for each cell going over the possibilities of green, red, yellow for 4 cells a row, thousands a row, would probably be a slow running macro. If you want the code for the conditional formatting in vba form let me take a look for a quick second, I won't get the colors right but I'll give you the skeleton!

  5. #5
    Forum Contributor
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    Version 14.4.3, Mac 2011
    Posts
    145

    Re: Conditional Format of cells based on other cell values

    I believe you have green red and yellow there from formulas that list them based on criteria rather than typing them out for thousands of rows. It might save you more time to stick those arguments in the conditional formatting arguments to start.
    The code I was working on isn't really working but i'll post the general idea, someone else can fix it since i'm actually pretty terrible with VBA XD and it's around 2 am here ~
    Please Login or Register  to view this content.
    Best of luck to you!

  6. #6
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Conditional Format of cells based on other cell values

    Red,

    That is correct. I have already built out the conditions for red, yellow, green through a series of IF statements, so that part is essentially done.

    Your concept code is pretty much what I'm going after, and remain interested in seeing if this could be further adapted to my example.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Conditional Format of cells based on other cell values

    Does this help?

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    07-30-2014
    Location
    USA
    MS-Off Ver
    Version 14.4.3, Mac 2011
    Posts
    145

    Re: Conditional Format of cells based on other cell values

    That's some reallllly nice stuff there Mr. Davis!

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Conditional Format of cells based on other cell values

    Quote Originally Posted by RedSummer View Post
    That's some reallllly nice stuff there Mr. Davis!
    Thanks for the compliment.

  10. #10
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Conditional Format of cells based on other cell values

    John,

    This is awesome!
    Thank you so much for your help, really appreciate it!

  11. #11
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Conditional Format of cells based on other cell values

    You're welcome. Glad to help out and thanks for the feedback.

+ 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] Conditional format a cell based on cumulative value of a row of cells
    By lynnepooh in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-21-2013, 09:47 AM
  2. Replies: 5
    Last Post: 10-24-2013, 05:34 PM
  3. [SOLVED] Conditional format for duplicate values based on criteria in a different cell
    By excelheaven in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-04-2012, 11:34 AM
  4. [SOLVED] Conditional Format cell based on value of cells in range
    By Dean81 in forum Excel General
    Replies: 5
    Last Post: 03-20-2012, 12:20 PM
  5. Conditional Format 1 cell based on other cells
    By dbrine in forum Excel General
    Replies: 7
    Last Post: 02-09-2009, 02:04 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