staff schedule

imported_unknown

Active Member
Joined
Jan 13, 2002
Messages
424
I am trying to create a staff schedule. It will finally figure the hours between start and end time, and subtract .5 hour for lunch. Now I need to add another condition for those working less than 5 hours. These should not have the .5 subtracted. This is how I was doing it so far.
=IF((24*(IF(C8>D8,D8+1-C8,D8-C8))-0.5)>0,(24*(IF(C8>D8,C8+1-C8,D8-C8))-0.5),0)
Help?
Thanks.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

flexinau

Board Regular
Joined
Sep 22, 2002
Messages
122
This formula will not work for difference in start and end times of 24 hours or more as the formula does not know the days worked.
Formula should work since no staff will work 24 hours straight.
For work of greater than 5 hours, the formula will take .5 hours for break. 5 hours or less, no 0.5 hours for breaks are deducted.

=IF((24*(IF(C8>D8,D8+1-C8,D8-C8))-0.5)>5,(24*(IF(C8>D8,D8+1-C8,D8-C8))-0.5),24*(D8-C8))
 

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
On 2002-10-04 23:07, GLD wrote:
I am trying to create a staff schedule. It will finally figure the hours between start and end time, and subtract .5 hour for lunch. Now I need to add another condition for those working less than 5 hours. These should not have the .5 subtracted. This is how I was doing it so far.
=IF((24*(IF(C8>D8,D8+1-C8,D8-C8))-0.5)>0,(24*(IF(C8>D8,C8+1-C8,D8-C8))-0.5),0)
Help?
Thanks.

Hi GLD:

Welcome to the Board!

Try ...

=IF(((D8-C8)+(C8>D8))*24>5,((D8-C8)+(C8>D8))*24-0.5,((D8-C8)+(C8>D8))*24)

Regards!

Yogi
 

Forum statistics

Threads
1,143,614
Messages
5,719,720
Members
422,242
Latest member
hishamkhatri

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
Top