Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Excel formula to compare date/time and report if it is less than 24 hours

I’m trying to create an excel formula to check the difference between cells C2 (opening time) and O2 (closing time) and add value within 24 hours or over 24 hours

INC6531515  4/03/2024 20:56 5/03/2024 07:16 Within 24 hours
INC6531448  4/03/2024 20:24 5/03/2024 07:17 Within 24 hours
INC6531334  4/03/2024 19:43 5/03/2024 07:17 Within 24 hours
INC6531245  4/03/2024 19:07 6/03/2024 08:13 Within 24 hours
INC6531043  4/03/2024 18:04                 Within 24 hours
 =IF(O2-C2<=24, "Within 24 hours", "Over than 24 hours")

This is just reporting that everything is within 24 hours

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Subtracting days returns a result in decimal days. Try subtracting the cell 6/03/2024 08:13 from 4/03/2024 19:07, this returns 1.545.... Thus, you formula should be =IF(O2-C2<=1, "Within 24 hours", "Over 24 hours").

Extension to empty cells:

=IF(OR(C2="",D2=""),"",IF(O2-C2<=1, "Within 24 hours", "Over 24 hours"))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading