+ Reply to Thread
Results 1 to 14 of 14

Conditional Formatting based on time difference between set criteria

  1. #1
    Registered User
    Join Date
    08-26-2018
    Location
    Narromine, Australia
    MS-Off Ver
    Office 365
    Posts
    47

    Conditional Formatting based on time difference between set criteria

    I'm trying to work out how to change the colour of a cell with conditional formatting when the time difference falls between two different ranges.

    I need to calculate waiting time.

    so if my time difference is works out to be 31 mins it need to change colour.

    so far i have this but it doesn't work how it should

    so for

    31 to 45 mins =AND(MOD($AT5,1)>=31/1440,MOD($AT5,1)<=45/1440)
    46 to 60 mins =AND(MOD($AT5,1)>=46/1440,MOD($AT5,1)<=60/1440)
    61 to 75 mins =AND(MOD($AT5,1)>=61/1440,MOD($AT5,1)<=75/1440)
    76 to 90 mins =AND(MOD($AT5,1)>=76/1440,MOD($AT5,1)<=90/1440)

    Most of it works but it will not included the 1 hour time frame and only works when you get 00:59 or 01:01.

    I don't know what i'm doing wrong but any help would be great.

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,737

    Re: Conditional Formatting based on time difference between set criteria

    seems to be working for me
    upto 1:30 and then 1:31 is false

    see attached formulas highlighted yellow
    and conditional formatting applied to A5
    Attached Files Attached Files
    Last edited by etaf; 02-11-2019 at 10:41 PM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    08-26-2018
    Location
    Narromine, Australia
    MS-Off Ver
    Office 365
    Posts
    47

    Re: Conditional Formatting based on time difference between set criteria

    So I'm still having issues with this and can't work it out.

    Anytime it get to the 61 mins it will not change with the condition formating.

    Both 60 mins and 62 mins change. I don't get it. It must be an error in Excel

    Does anyone know of any other formula that will allow me to do this. I've searched the internet and just can't find something that matches this.

    Any help would be great

    I have attached the spreadsheet so you can see what it going on. Goto Cell AT5
    Attached Files Attached Files

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Conditional Formatting based on time difference between set criteria

    Try this:

    =AND((VALUE($AT5)*60)>=31,(VALUE($AT5)*60)<=45)

    and so on.
    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.

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Conditional Formatting based on time difference between set criteria

    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
    08-26-2018
    Location
    Narromine, Australia
    MS-Off Ver
    Office 365
    Posts
    47

    Re: Conditional Formatting based on time difference between set criteria

    Sorry I should have said AW5

    I changed it to

    Please Login or Register  to view this content.
    and I couldn't get it to work. It didn't change the colours at all.

    I don't know why it's not working. It should work.

  7. #7
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Conditional Formatting based on time difference between set criteria

    It works here. My guess is that another CF rule is interfering. I suggest you try it on another workbook with just that rule and see what happens.

  8. #8
    Registered User
    Join Date
    08-26-2018
    Location
    Narromine, Australia
    MS-Off Ver
    Office 365
    Posts
    47

    Re: Conditional Formatting based on time difference between set criteria

    I've made a new workbook and still can't get it to work.

    Might be something to do with the 24 hour time or the way I want it to function.

    I don't know
    Attached Files Attached Files

  9. #9
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,908

    Re: Conditional Formatting based on time difference between set criteria

    Change to:

    =AND($C1*1440>30,$C1*1440<=45)

  10. #10
    Registered User
    Join Date
    08-26-2018
    Location
    Narromine, Australia
    MS-Off Ver
    Office 365
    Posts
    47

    Re: Conditional Formatting based on time difference between set criteria

    I changed the code and it still is doing that silly 61 min thing

    I uploaded the file to see if it's just my computer or not

    Edit - Reuploaded file with some changes - Thought it might be something to do with 24 hour format but it's not
    Attached Files Attached Files
    Last edited by Wolfieee; 03-19-2019 at 04:38 AM. Reason: File Change

  11. #11
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Conditional Formatting based on time difference between set criteria

    Floating Point error
    https://www.microsoft.com/en-us/micr...wrong-answers/

    Please try
    =AND(ROUND((C1)*1440,)>=61,ROUND((C1)*1440,)<=75)

  12. #12
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,908

    Re: Conditional Formatting based on time difference between set criteria

    Try again:

    =AND(ROUND($C4*1440,6)>=31,ROUND($C4*1440,6)<=45)

  13. #13
    Registered User
    Join Date
    08-26-2018
    Location
    Narromine, Australia
    MS-Off Ver
    Office 365
    Posts
    47

    Re: Conditional Formatting based on time difference between set criteria

    Please Login or Register  to view this content.
    Works great !!

    I would never have thought to use ROUND

    Also thanks for the info aobut the Floating Point Error. Interesting that a simple calulation can cause issues.

    It's been bugging me for months how to work this out.

    Thanks again everyone

  14. #14
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,908

    Re: Conditional Formatting based on time difference between set criteria

    You're welcome! Thanks for the rep points

+ 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 according to difference in time in 2 cells
    By so_fistica_ted in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-18-2017, 01:56 PM
  2. [SOLVED] Conditional Formatting of Cells based off of date and time criteria
    By rhett7660 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 12-16-2015, 03:14 PM
  3. [SOLVED] Conditional formatting based on % difference
    By Raywoot in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-21-2015, 06:07 AM
  4. conditional formatting based on time difference
    By arindamsenaxa in forum Excel General
    Replies: 4
    Last Post: 11-28-2014, 10:58 AM
  5. time difference - conditional formatting and fix
    By Lukael in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-06-2014, 11:16 AM
  6. conditional formatting and difference in time
    By Time to Learn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-17-2013, 10:37 PM
  7. Conditional Formatting Based on Percent Difference
    By dontcare in forum Excel General
    Replies: 1
    Last Post: 06-18-2010, 05:10 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