lemonsnapple
lemonsnapple

Reputation: 11

Check whether current time is in range

I'm using Googlesheets and can't find a way to check if current time is within 2 time values (e.g. 08:00 and 16:00).

Boolean check is straightforward: =AND(NOW()>=A2,NOW()<=B2)

If current time is 16:00, desired output:

Start   End    Check  
8:00    18:00  TRUE
8:00    13:00  FALSE

However, I'm just getting FALSE returns constantly:

Start   End    Check  
8:00    18:00  FALSE
8:00    13:00  FALSE

Issue seems to lie with the NOW() function. If I replace NOW() with static time values, the formula works.

Is there any way to call the current time without using NOW()?

Thanks in advance!

Upvotes: 0

Views: 28

Answers (1)

ziganotschka
ziganotschka

Reputation: 26836

Use =TIMEVALUE()

Sample:

=AND(TIMEVALUE(NOW())>=TIMEVALUE(A2),TIMEVALUE(NOW())<=TIMEVALUE(B2))

Upvotes: 1

Related Questions