Criteria for NS and DS time

nazarene

New Member
Joined
Jun 25, 2015
Messages
43
Office Version
  1. 365
Platform
  1. Windows
Dear sir,
I have this problem for creating formula,
Day Shift= 7:00to 17:00
In Day Shift all time before 7:00 will consider & 7:00am, while after 7:00 will take the actual, example the employee comes at 6:45 it will consider as 7:00, but if the employees comes 7:25 it will take 7:25

Night shift
Night shift will start at 21:00 up to 6:00 in the morning, anytime out of that will be OT
the below is my table
1614776947823.png

1614777014340.png
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
MrExcelPlayground.xlsm
JKLMNOPQ
3NameDate inTime inEffective Time inDate outTime outTotalOT hours
4Harry12/20/20207:367:3612/20/202018:0410:280:00
5Fred12/20/20206:457:0012/20/202021:3014:300:30
6Mary12/20/20206:557:0012/21/20201:0018:004:00
Sheet29
Cell Formulas
RangeFormula
P4:P6P4=(N4+O4)-(K4+M4)
Q4:Q6Q4=MAX((N4+O4)-(K4+21/24),0)
M4:M6M4=MAX(L4,7/24)

It won't work right for shifts longer than 24 hours.
 
Upvote 0
Sir how about if we started at
21:00 to 6:00 (this is for Night shift) how to compute in reverse
 
Upvote 0
I mean time in is started at 21:00 up to 6:00 for night shift and the excess will be OT
 
Upvote 0
MrExcelPlayground.xlsm
JKLMNOPQ
12NameDate inTime inEffective Time inDate outTime outTotalOT hours
13Harry12/20/202021:3621:3612/21/20206:008:240:00
14Fred12/20/202020:4521:0012/21/20207:0010:001:00
15Mary12/20/202020:5621:0012/21/20209:0012:003:00
Sheet29
Cell Formulas
RangeFormula
P13:P15P13=(N13+O13)-(K13+M13)
Q13:Q15Q13=MAX((N13+O13)-(N13+6/24),0)
M13:M15M13=MAX(L13,21/24)
 
Upvote 0
Dear Sir james,

Thank you so much , you are really excel black belter :)



Regards,
Nazarene
 
Upvote 0
Dear Sir James,
One more Criteria , I want to know, because in your figure below
there should be no OT, because the starts of work is 7 am until 5 pm, it means 10 hours of work as regular, he works at 9:45am until 5:09pm, so he did not achieve the 10 hours normal, 7hr. and 24 minutes , so he has 0 OT. Can you pelase help me again to include that formula

Effective DateTime OutTotal HoursOT Hours
9:45:00 AM5:09:06 PM7:240:09
 
Upvote 0
I don't understand the OT rules. I currently have any hours after 21:00 (9pm). Is it any hours past 10 working hours? That would be easier.
 
Upvote 0
Good day to you again Mr. James.
Can you please help me to make a formula related as per below table, now I am mannualy doing the process,
the logic is like this, I would like to get only the hours spent from the range of 9:00pm to 6:00am.

For example:
In item # 1- The workers starts to work from 6:27am until 10:09pm so the 9pm to 10:09pm equal hours spent will be 1 hours and 9 minutes
In item # 2 - The Workers starts to work from 4:15am until 12:17pm so the 4:15am to 6:00am equal hours spent will be 1 hours and 45 minutes


1630464343922.png


Thank you and best regards
 

Attachments

  • 1630463807367.png
    1630463807367.png
    13 KB · Views: 1
  • 1630464063745.png
    1630464063745.png
    18.5 KB · Views: 1
Upvote 0
I'm not sure what version of excel you have - if it's 365, this will work:
Mr Excel Playground 3.xlsm
ABCDEF
1Between 9pm and 6am
216/26/20216:27:466/26/202123:09:592:09
327/27/20214:15:477/27/202112:17:251:45
437/27/20213:45:207/27/202113:28:152:15
546/26/20216:27:396/26/202122:09:531:09
657/27/20213:54:207/27/202112:05:422:06
767/27/202120:00:007/28/20218:00:009:00
Sheet20
Cell Formulas
RangeFormula
F2:F7F2=(COUNT(MATCH(MOD(SEQUENCE(((D2+E2)-(B2+C2))*60*24,1,INT(C2*60*24),1),1440),SEQUENCE(360,1,0,1),0))+COUNT(MATCH(MOD(SEQUENCE(((D2+E2)-(B2+C2))*60*24,1,INT(C2*60*24),1),1440),SEQUENCE(180,1,1260,1),0)))/24/60
 
Upvote 0
Solution

Forum statistics

Threads
1,214,943
Messages
6,122,376
Members
449,080
Latest member
Armadillos

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