In Google Sheets, I'm trying to set cell background colour using conditional formatting based on the time of the day compared to the time value in the cells.
For example, I want to set a different colour for a cell whose time is:
- 1.5 hours away from the current time
- 30 mins away from the current time
- Matches the current time or has just passed.
The data in the cells are times that span a 24-hour period that starts at 03:30 and ends at 03:29 on the following day. However the cells only contain times, no dates as it's a weekly template that we copy.
I want to ensure that a cell containing 02:00 in Monday's sheet doesn't have formatting applied until Tuesday at 00:30 which would be 1.5 hours before its time.
This is the formula I'm currently using for the 1.5 hours before
=OR(AND(NOT(ISBLANK($A1)), OR(TIME(HOUR(NOW()), MINUTE(NOW()), SECOND(NOW())) >= TIME(3, 30, 0), TIME(HOUR(NOW()), MINUTE(NOW()), SECOND(NOW())) < TIME(3, 29, 0)), TIME(HOUR(NOW()), MINUTE(NOW()), SECOND(NOW())) >= $A1 - TIME(1, 30, 0), TIME(HOUR(NOW()), MINUTE(NOW()), SECOND(NOW())) < $A1 - TIME(0, 30, 0)))But this is still showing 0200 as late all day until after midnight.
I also don't want any of Tuesday's conditional formatting rules to show up until Tuesday at 0030, but none of the formulas I'm trying are working.