+ Reply to Thread
Results 1 to 7 of 7

Conditional Formatting, problem with cell colour fill based on another cell value

  1. #1
    Registered User
    Join Date
    06-13-2013
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    14

    Conditional Formatting, problem with cell colour fill based on another cell value

    Hi,

    Am experiencing a problem, and hoping someone can help - I have a formula that subtracts 24hr times
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    , one from another (cell A1-A2 to give a result in A3, in hh:mm). I also have a similar table that I am trying to get conditional formatting to highlight the cell (A3) in green, if the value in cell B3 is of the same value. I can do this using conditional formatting if no formula is present in cell A3, but cannot get conditional formatting to work if the formula is present - any ideas greatly appreciated!.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional Formatting, problem with cell colour fill based on another cell value

    Is there a formula in cell B3?

    You may have to use rounding on cell A3.

    Here's another way to subtract times and account for times that span past midnight:

    A1 = 3:00 AM
    A2 = 7:00 PM

    =MOD(A1-A2,1)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    06-13-2013
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: Conditional Formatting, problem with cell colour fill based on another cell value

    Hi Tony,

    Many thanks for the reply, and yes indeed, the formula you gave also works very nicely....

    And yes, there is a formula in B3 cell, which is the reason why I think I cannot get CF to work?

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional Formatting, problem with cell colour fill based on another cell value

    Try using rounding on the formula in cell A3:

    This will round to the nearest minute:

    =ROUND(your_formula*1440,0)/1440

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

    Re: Conditional Formatting, problem with cell colour fill based on another cell value

    Ah, your other thread was closed, but Tony's response covers it. Here is what I tried to post to your other thread:

    You can use a formula for your conditional format like this:

    =F6-N6<0.000000001

    Time values are stored as fractions of a 24-hour day, and as such you can have very small variations in values (corresponding to fractions of a second) which prevent you from using a formula like:

    =F6=N6

    as they are not truly identical.

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    06-13-2013
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: Conditional Formatting, problem with cell colour fill based on another cell value

    Firstly, apologies for thread duplication.......

    Tony, Pete....many thanks for that....at last the "light bulb" moment has occurred for me....and see what you are both saying now.....I hadn't comprehended that the time results from the formula I had in place wasn't exact (i'm a little thick sometimes!), and therefore for CF to work, it needed to be rounded.....doh!

    Many thanks once again....works perfectly now

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Conditional Formatting, problem with cell colour fill based on another cell value

    You're welcome. We appreciate 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. Conditional Formatting - Blank cell fill problem....
    By LDouble3 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-06-2012, 09:35 AM
  2. [SOLVED] Conditional Formatting to Change Cell Colour Based on Date
    By Kym2101 in forum Excel General
    Replies: 5
    Last Post: 05-01-2012, 11:41 PM
  3. A conditional formatting cell colour problem
    By 3Bowls in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2011, 05:55 AM
  4. conditional formatting based on cell colour
    By nervous_pilchard in forum Excel General
    Replies: 0
    Last Post: 07-12-2011, 05:29 AM
  5. Colour Fill cell range in (Conditional formatting XL2007)
    By airbus319uk in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-27-2007, 06:34 AM

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