Reputation: 1382
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
Reputation: 3952
Use this formula in B1:
=IF(NOW()-A1 > 1,"No","Yes")
check the following for more info:
Datetime difference:
Get current datetime (NOW):
If cell is greater than:
https://exceljet.net/formula/if-cell-is-greater-than
Upvotes: 1
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