# Formula Needed - Calculate total hours that fall between a specific time period.

1. ## Formula Needed - Calculate total hours that fall between a specific time period.

Good afternoon All -
This is my first time on this forum and I love the amount of information I have already learned.
My question is:

I have two colums - shift start and shift end.
Shift Start Shift End
0:00 05:00

I need to calculate the hours between 00:00-04:00 and the amount of hours bewteen 04:00-06:00.
For 00:00-0400 this example would show 4 hours
For 04:00-06:00 this example would show 1 hour

Thank you.
Jenny  Register To Reply

2. ## Re: Formula Needed - Calculate total hours that fall between a specific time period.

Jenny,
You should be able to simply subtract the values (End-Start).  Register To Reply

3. ## Re: Formula Needed - Calculate total hours that fall between a specific time period.

Can the shift start before midnight, e.g. 20:00 to 05:00?

To cover that possibility try this formula for 0:00 to 4:00

=(B2<A2)*"4:00"+MIN(B2,"4:00")-MIN(A2,"4:00")

and for 04:00 to 06:00

=(B2<A2)*("6:00"-"4:00")+MEDIAN(B2,"4:00","6:00")-MEDIAN(A2,"4:00","6:00")

That last one can be used generically for any period  Register To Reply

4. ## Re: Formula Needed - Calculate total hours that fall between a specific time period.

Hi and thank you for the help I tried the formula and its giving a response of 2:59 for 0000-0400 and 2:00 for 0400-0600 Any ideas?

Againt hank you for helping.
Jenny  Register To Reply

5. ## Re: Formula Needed - Calculate total hours that fall between a specific time period.

Thank you mshale That formula gives me total hours but I need specific hours for specific time periods between the two times.

Again thank you so much for trying to help. Happy Friday!  Register To Reply

6. ## Re: Formula Needed - Calculate total hours that fall between a specific time period.

I double checked Daddy LL's formulas and they gave the correct answers (4:00 and 1:00 respectively). His formula (as written) assumes start time in A2 (0:00) and end time in B2 (5:00). Does that match your data?  Register To Reply

7. ## Re: Formula Needed - Calculate total hours that fall between a specific time period.

Please accept my apology as i copied the formula and of course somewhere did not check my orignal numbers on my file.

Thank you so much- you are a LIFE SAVER!!!
PS: I love this site - it is amazing!  Register To Reply

8. ## Re: Formula Needed - Calculate total hours that fall between a specific time period.

If I would need to calculate the time that fall between 22:00 and 6:00 how should I modify the formula?

Thank you  Register To Reply

9. ## Re: Formula Needed - Calculate total hours that fall between a specific time period.

Welcome to the forum. We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

If you are not familiar with how to start a new thread see the FAQ: How to start a new thread  Register To Reply

There are currently 1 users browsing this thread. (0 members and 1 guests) 