OzGrid

How to obtain True / False statement if times are within x minutes of each other

< Back to Search results

 Category: [Excel]  Demo Available 

How to obtain True / False statement if times are within x minutes of each other

 

Requirement:

 

What I would like to know is if there is a formula that can return a true or false result if two times are within say 1 hour of each other?
As an example say I have the following in Cell F1 of sheet ‘Time’ 12/06/2018 15:17:51 and in Cell G1 of Sheet ‘Time’ I have 12/06/2018 15:46:37 I would like the formula to return the result in Cell H1
Thank you

 

Solution:

 

Code:
=IF(ABS(F1-G1)<=0.041666667,TRUE(),FALSE())

Note: 0.041666667 is the time serial number for 1 hour.

OR

Code:
=IF(ABS(F1-G1)<=TIME(1,0,0),TRUE(),FALSE())

is better - more easily configurable... the parameters are TIME(Hours,Minutes,Seconds)

 

Obtained from the OzGrid Help Forum.

Solution provided by Infomage.

 

See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets

 

See also:

How to obtain a true or false statement if a customer is a repeat customer
How to convert time from xx minutes to xx seconds into HH:MM:SS

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


Gallery