An hour is 1/24th of a day; therefore, in Excel, hours are decimal values from 0.0000 to 0.9999.
Days are integer values 1,2,3,,,,
If your finish time is less than the start time, then you need to add 1 (day) to the finish time.
e.g.:
B5: Start @ 18:00 (Excel value: 0.7500)
C5: Finish @ 01:30 (Excel value: 0.06250)
Check if the finish is less than the start and add 1 (day) to the finish
Note: the expression (B5>C5) returns true (1) or false (0) as the multiplier for the 1 to be added. In this case true * 1=1 + 0.0625=1.0625
Subtract the start time 10.6250-0.75=0.31
If you format the cell as time, it will display 07:30
However, you should format as a number and multiply by 24 to get the duration in hours and not a clock time:
24*0.31 = 7.5 hours
Thus, in D5:
and formatted as number
Bookmarks