# Formula count of hours between start/finish times

1. ## Formula count of hours between start/finish times

Hello every body,

I am creating a log of hours worked, so my input is start/finish times in hh:mm format, and I wish for excel to calculate automatically specific hours between start/finish times.

example:
start: 18:00
finish 06:00

night hours: I help in finding a formula to count the total hours 22:00 to 04:00 giving 6,0

Any help appreciated
robenson  Register To Reply

2. ## Re: Formula count of hours between start/finish times

Try =MOD(A2-A1, 1)  Register To Reply

3. ## Re: Formula count of hours between start/finish times

In terms of night shift - if we assume B2 holds Finish and A2 start then: ``Please Login or Register  to view this content.``
edit: was missing 22:00 to midnight  Register To Reply

4. ## Re: Formula count of hours between start/finish times

Assuming that shift could be any length up to 24 hours, e.g. even 03:00 until 22:30, for example, then try this formula in C2 where A2 is shift start and B2 shift end

=MOD(B2-A2;1)*24-(A2>B2)*18-MEDIAN(4;22;B2*24)+MEDIAN(4;22;A2*24)

format C2 as number to get decimal hours  Register To Reply