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

Know if a time is between two times

1

How do I tell if a time in one cell is within two times in other cells?

all three of the cells are formatted as time h:mm:ss

thanks for any help!

Answer
Discuss

Answers

1
Selected Answer

In A1:C1...

1:01:27 3:37:17 2:45:43

Check if C1 is between A1 and B1 

=IF(AND(C1>=MIN(A1:B1),C1<=MAX(A1:B1)),"You betcha","Nope")

Discuss

Discussion

Ahhh so I can just compare it like you do with regular numbers? And is there any problem with me using a formula like this...
=IF(AND(C1>=A1,C1<=B1),"You betcha","Nope")
I modified it from yours and it seems like it works just fine like yours.

thanks so much for the fast response!
bluegreenpastures (rep: 4) Apr 6, '17 at 1:10 am
Yeah, that's fine just so long as the one time is always the earlier and the other is always the later. My formula just accounts for if that's not always the casae.
gebobs (rep: 30) Apr 6, '17 at 8:19 am
Just to add a little clarity regarding times and dates in Excel, they are actually floating point decimal numbers formatted to display as time and/or date. A day is equal to 1, an hour equals 1/24, a minute equals, 1/1440, and so on. January 1, 1900 midnight is 0 and each day thenceforth adds 1. Thus the value for the current time here and now is 42831.35331.
gebobs (rep: 30) Apr 6, '17 at 8:29 am
Thanks for all that information, times and dates are just so confusing for me in Excel :/
bluegreenpastures (rep: 4) Apr 20, '17 at 4:26 am
Add to Discussion


Answer the Question

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