wenn32
wenn32

Reputation: 1382

How to find if datetime is lesser than 24 hours in excel

Lets say I got datetime as '2017-02-25 09:28:42' in cell 'A1' of Excel.

How do I find if datetime is less than 24 hours and output result as "Yes" or "No" in cell 'B1'?

Example: Assuming current time is '2017-02-25 09:28:42'

-------------------------
2017-02-19 08:28:42 | No
-------------------------
2017-02-24 23:28:42 | Yes
-------------------------

Upvotes: 1

Views: 1254

Answers (2)

Nick
Nick

Reputation: 147146

The expression NOW()-A1 will return the difference in days between the datetime in A1 and the current time. So to check if the time is A1 is less than 24 hours (1 day) before the current time, use

=IF(NOW()-A1 > 1,"No","Yes")

Upvotes: 0

Related Questions