Calculate Night shift between 2 times

elynoy

Board Regular
Joined
Oct 29, 2018
Messages
160
Office Version
  1. 365
  2. 2021
  3. 2016
Platform
  1. Windows
Hello, I'm having trouble with a formula considering the work as night shift. The formula works fine untill it reaches the AM values.

I'll post a picture:
15cofiu.jpg



the formulas I have in there are:
Code:
C6 =(($F6>$G6)*MEDIAN(0,$G6-$H$5,MEDIAN($H$5,$F$5))+MAX(0,MIN($F$5,$G6+($F6>$G6))-MAX(1/4,$F6)))
D6 =MOD(G6-F6,1)
B6 =D6-C6

The problem is, like in the picture, if the start time is below 23:59 it works like a charm, but, if the start time is 01:00 it will mess up the calculations.

Best regards,
eLy
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
can anyone help me out?


If i put 25:00 instead of 01:00 it works.

When I insert 25:00 the cell will change to 01:00 but that doesnt make sence to use.

Best regards,
eLy
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top