Hi,
Thanks for sharing the details. For older Excel, here’s a simple way to calculate Night Differential (18:00–06:00) and Sunday hours.
Add two helper cells:
Start: =B2+E2
End: =B2+F2+(F2<E2) (adds a day if OUT < IN)
Night Diff:
=(MAX(0, MIN(T2, INT(S2)+1) - MAX(S2, INT(S2)+TIME(18,0,0))) +
MAX(0, MIN(T2, INT(S2)+1+TIME(6,0,0)) - MAX(S2, INT(S2)+1)))*24
Sunday Diff:
First find Sunday: =INT(S2)-WEEKDAY(S2,2)+7
Then: =MAX(0, MIN(T2, V2+1) - MAX(S2, V2))*24
Format as numbers for hours. These formulas handle shifts crossing midnight and work in older Excel.
Hope this helps!
Edward