+ Reply to Thread
Results 1 to 21 of 21

Conditional Formatting Add 8 hours

  1. #1
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Conditional Formatting Add 8 hours

    Hello world,
    I am attempting to use conditional formatting to shade cells depending on completion times. Here is my setup and as always thank you very much for any and all help.

    F2 = Start Time
    R2 = Completion Time

    Here's my formula for red.
    =$R2<($F2+8/24)

    Rules
    Less than 8 hours from start to complete green
    exact or 1 hour over yellow
    greater than 1 hour over red

    I believe the issue I am running into is, since all of the times are overnight, when the time rolls past midnight the formula automatically assumes that it is way over or under the set formulas. Is there a way to do this without adding new columns? I've attached my testing spreadsheet to here as well.
    Attached Files Attached Files
    Last edited by AliGW; 07-09-2019 at 03:05 AM. Reason: Title made search engine friendly.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,428

    Re: Conditional Formatting Add 8 hours

    See if this resolves the issue:

    =$R2<MOD($F2+480/24/60,1)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Conditional Formatting Add 8 hours

    It seems to have done the reverse of what I am wanting. Everything under 8 hours is now red and all others are currently blank.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,428

    Re: Conditional Formatting Add 8 hours

    OK, well try this, then:

    =$R2>MOD($F2+480/24/60,1)

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,428

    Re: Conditional Formatting Add 8 hours

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  6. #6
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Conditional Formatting Add 8 hours

    Just about there . Now when I have all formulas in place, the yellow seems to be overriding the red. I've attached an updated version of my testing sheet.

    Attachment 631393

    Attachment 631392
    Attached Files Attached Files

  7. #7
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Conditional Formatting Add 8 hours

    or try below
    =MOD(R2-F2,1)<1/3
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,428

    Re: Conditional Formatting Add 8 hours

    Order the rules in the order you wish Excel to apply them - move the red rule above the amber rule. Use the up/down arrows in the CF dialog to do this.

  9. #9
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Conditional Formatting Add 8 hours

    Moving it up did the trick. Should I worry about using any of the "Stop If True" boxes?

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,428

    Re: Conditional Formatting Add 8 hours

    Not if you are happy for Excel to stop if they are true! In other words, not continue looking at later rules if one is met.

    You need to think about the logical order you would apply the criteria and if any of your criteria are 'blurry', i.e. might overlap with each other. Does this make sense? Thorough testing should flush out any remaining issues.

  11. #11
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Conditional Formatting Add 8 hours

    Makes sense. Thank you very much for your help.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,428

    Re: Conditional Formatting Add 8 hours

    No problem. As I think I said to you before (or someone else recently), CF is a bit of a black art ...

  13. #13
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Conditional Formatting Add 8 hours

    I'm running into a new issue with a similar scenario. I have 2 columns, start time and finish time, both are formatted to 00:00.
    Some of the formulas are working properly and some are not, but then in a different cell the same formula that works elsewhere doesn't work there.
    I've attached my updated testing sheet with the new formulas in place. The rules I am trying to establish are below.

    Finish Time: < or = 1hr green
    Finish Time: > up to 1hr yellow
    Finish Time: > by 2hr+ red
    Attached Files Attached Files

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,428

    Re: Conditional Formatting Add 8 hours

    You've left the thread marked solved - remove the tag.

    I'll have a look for you.

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,428

    Re: Conditional Formatting Add 8 hours

    I don't think you have quite understood my comments about the order you should add the rules and whether or not to use Stop if True. Try this:
    Attached Images Attached Images

  16. #16
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Conditional Formatting Add 8 hours

    It is still not formatting correctly for some reason. It seems the issue is again when the time goes past midnight, but on one of them it does work which is odd. I'm not sure if my screenshot shows like yours does or not.

    Attachment 631414

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,428

    Re: Conditional Formatting Add 8 hours

    You are not paying attention!!!

    Look at the ORDER of the rules in my screenshot. Yours is not the same ...

  18. #18
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Conditional Formatting Add 8 hours

    Sorry, attached wrong pic.
    Attachment 631417

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,428

    Re: Conditional Formatting Add 8 hours

    The problem is the start time - when it is more than 2 hours, it causes a problem. You are going to need to adjust your formula to check this as part of the calculation (in all of the rules).

  20. #20
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Conditional Formatting Add 8 hours

    Ok. I will work on this some more and see what I come up with then put it on here. Thank you again for all of your help.

  21. #21
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Conditional Formatting Add 8 hours

    I managed to resolve the issue with start time and crossing over midnight by adding some hidden cells with set times and building new CF formulas around those times with IF/OR.

+ 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] Timesheet that calcs time in, time out, lunch used, reg hours, ot hours, double hours
    By noobface in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-21-2021, 03:45 AM
  2. Replies: 3
    Last Post: 07-24-2018, 03:24 AM
  3. Seperate simple hours, holiday hours and night hours
    By enitron in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-27-2014, 07:22 AM
  4. Replies: 3
    Last Post: 06-18-2014, 07:26 AM
  5. [SOLVED] Calculate hours with predefined Working Hours and Weekend Hours
    By garciapliz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-05-2013, 11:17 AM
  6. Replies: 4
    Last Post: 02-12-2013, 07:01 AM
  7. Replies: 2
    Last Post: 02-11-2013, 02:26 PM

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