As Siva pointed - it would be better to work on sample file with expected results. You may try (separate this into pieces if you need separate columns with output):
Formula:
="Leo worked: " &TEXT(MOD(B1+17/24,1)-MOD(A1+17/24,1),"hh:mm")&" hour(s) total, ot which: " & TEXT(MAX(MIN(MOD(B1+17/24,1),0.5)-MOD(A1+17/24,1),0),"hh:mm")&" morning, and " & TEXT(MAX(0,MOD(B1+17/24,1)-MAX(MOD(A1+17/24,1),0.5)),"hh:mm") & " night."
if there is no situation that Leo starts late night (say 5:00 AM and ends in the morning (9:00 AM) shall work fine
Bookmarks