Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

How can I conditionally format cells based on times that span days? [closed]

$
0
0

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. 1.5 hours away from the current time
  2. 30 mins away from the current time
  3. 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.


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>