Subtract break > or < certain number of hours worked

Jabsrocha

New Member
Joined
Jan 7, 2018
Messages
3
Good evening all,

I've taken some excellent examples already from you forum, but now I'm struggling with a more complicated one which I can't find an answer for.

To complete my timesheet.
If I work less than 8 hours no break is discounted.
Between 8 and 10 hours, 30 min. are discounted.
More than 10 hours, 1 hour is discounted.

I have this so far, and it works only for "greater than".

=IF(OR(ISBLANK(E32),ISBLANK(D32)),"",E32-D32-(E32-D32>TIME(8,0,0))*TIME(0,30,0))


I don't know what to do for the rest.
Please help.
Thanks
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Either use the following Table in the formula...

=E32-D32-TIME(0,LOOKUP(E32-D32,INDEX(Table,0,1),INDEX(Table,0,2)),0)

Or the formula with a hard-coded table:

=E32-D32-TIME(0,LOOKUP(E32-D32,{0;0.333344907407407;0.416678240740741},{0;30;60}),0)
 
Upvote 0
Hi,

I might be misunderstanding, but I think Aladin needs a slight adjustment to his formula to include discounting 8 hours by 30 minutes:

I've also provided a couple of alternatives:


Book1
ABCDE
28Net HoursNet HoursNet Hours
291 wayAnother wayAladins
308:308:308:30
317:307:308:00Start TimeEnd Time
327:307:307:309:00 AM6:00 PM
3310:0010:0010:009:00 AM5:00 PM
349:309:309:309:00 AM4:30 PM
359:00 AM8:00 PM
369:00 AM7:00 PM
Sheet1
Cell Formulas
RangeFormula
A30=IF(OR(ISBLANK(E32),ISBLANK(D32)),"",(E32-D32)*24-IF((E32-D32)*24>10,1,IF((E32-D32)*24>=8,0.5,0)))/24
B30=IF(OR(ISBLANK(E32),ISBLANK(D32)),"",E32-D32-IF(E32-D32>TIME(10,0,0),TIME(1,0,0),IF(E32-D32>=TIME(8,0,0),TIME(0,30,0),0)))
C30=E32-D32-TIME(0,LOOKUP(E32-D32,{0,0.333344907407407,0.416678240740741},{0,30,60}),0)
 
Upvote 0
Thank you both for you help.
I'm going with suggestion in B30, but with a small modification.

=IF(OR(ISBLANK(E32),ISBLANK(D32)),"",E32-D32-IF(E32-D32>=TIME(10,0,0),TIME(1,0,0),IF(E32-D32>=TIME(8,0,0),TIME(0,30,0))))

">=" In both time slots and I deleted the remaining ",0" which doesn't affect the outcome, I think?

Thanks again
 
Upvote 0
If I work less than 8 hours no break is discounted.
Between 8 and 10 hours, 30 min. are discounted.
More than 10 hours, 1 hour is discounted.

You're welcome, welcome to the forum.

If you use ">=" in the first TIME test, that would include discounting 1 hour instead of 30 minutes for 10 hours worked which contradicts your description in your OP, but if that's what you meant, then you're right to add the =.

Also, you're correct, the last 0 doesn't affect the outcome, I put it in just to satisfy the IF formula syntax (Value if false).
 
Upvote 0
Either use the following Table in the formula...

=E32-D32-TIME(0,LOOKUP(E32-D32,INDEX(Table,0,1),INDEX(Table,0,2)),0)

Or the formula with a hard-coded table:

=E32-D32-TIME(0,LOOKUP(E32-D32,{0;0.333344907407407;0.416678240740741},{0;30;60}),0)

I see Table is not there...

[TABLE="class: grid, width: 128"]
<tbody>[TR]
[TD="width: 64, bgcolor: transparent, align: right"]0:00:00[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]0[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]8:00:01[/TD]
[TD="bgcolor: transparent, align: right"]30[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]10:00:01[/TD]
[TD="bgcolor: transparent, align: right"]60[/TD]
[/TR]
</tbody>[/TABLE]

You can add...

=IF(D32*E32,X,"")

where X is one of the suggested formulas.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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