Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Finding if times fall within a specific hour window

0

Hello,

I have been trying to figure out a formula where a time falls within an 8 hour window.

For example: I am trying to calculate the time data was collected and the time the test was administered falls within an 8 hour window.

Answer
Discuss

Answers

0
Selected Answer

If it's a simple time during the day, you can use the hour function combined with an IF statment.

=IF(HOUR(A2)-HOUR(A1)<=8,"Within 8 hours.","NOT within 8 hours.")

Cells A1 and A2 should be the times and they must be in an Excel date/time format in order to work.

Discuss

Discussion

Ah! Thank you so much! I couldn't not figure out how to write out the "8 hour window." And it's obviously written as it's spelled out... lol

Thank you again!
arexniba (rep: 2) Mar 6, '17 at 4:32 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login