Subtracting 30 minutes only if parameters are met...

Sailorzane

New Member
Joined
Oct 23, 2019
Messages
3
I have a time sheet calculator that i developed to calculate summations for me in respect to total hours worked for an individual. I stumped myself and believe I am over thinking the equation. Essentially i need it to subtract 30 minutes for a break if certain conditions are met, 8 hours or more worked, and if the log in and log out cells are populated. Thank you for your help.

[TABLE="width: 303"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Log in [/TD]
[TD]Log Out[/TD]
[TD]Total Hours [/TD]
[/TR]
[TR]
[TD]Monday[/TD]
[TD][/TD]
[TD][/TD]
[TD]##########[/TD]
[/TR]
[TR]
[TD]Tuesday[/TD]
[TD][/TD]
[TD][/TD]
[TD]##########[/TD]
[/TR]
[TR]
[TD]Wednesday[/TD]
[TD]7:00 AM[/TD]
[TD]6:48 PM[/TD]
[TD]11:18[/TD]
[/TR]
[TR]
[TD]Thursday[/TD]
[TD]7:59 AM[/TD]
[TD]6:56 PM[/TD]
[TD]10:27[/TD]
[/TR]
[TR]
[TD]Friday[/TD]
[TD]7:09 AM[/TD]
[TD]6:17 PM[/TD]
[TD]10:38[/TD]
[/TR]
[TR]
[TD]Saturday[/TD]
[TD]7:09 AM[/TD]
[TD]6:39 PM[/TD]
[TD]11:00[/TD]
[/TR]
[TR]
[TD]Sunday[/TD]
[TD]7:55 AM[/TD]
[TD]12:29 PM[/TD]
[TD]4:04[/TD]
[/TR]
[TR]
[TD]Monday[/TD]
[TD][/TD]
[TD][/TD]
[TD]##########[/TD]
[/TR]
[TR]
[TD]Tuesday[/TD]
[TD]6:59 AM[/TD]
[TD]6:13 PM[/TD]
[TD]10:44[/TD]
[/TR]
[TR]
[TD]Wednesday[/TD]
[TD]7:03 AM[/TD]
[TD]6:33 PM[/TD]
[TD]11:00[/TD]
[/TR]
[TR]
[TD]Thursday[/TD]
[TD]7:00 AM[/TD]
[TD]7:05 PM[/TD]
[TD]##########[/TD]
[/TR]
[TR]
[TD]Friday[/TD]
[TD]6:50 AM[/TD]
[TD]7:16 PM[/TD]
[TD]##########[/TD]
[/TR]
[TR]
[TD]Saturday[/TD]
[TD]7:29 AM[/TD]
[TD]6:24 PM[/TD]
[TD]10:25[/TD]
[/TR]
[TR]
[TD]Sunday[/TD]
[TD]6:53 AM[/TD]
[TD]5:55 PM[/TD]
[TD]10:32[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]TOTAL[/TD]
[TD]64.15[/TD]
[/TR]
</tbody>[/TABLE]


Monday is A8 and the total is D23.
The formula in the first total hours cell is: =(C8-B8+IF(MOD(C8-B8,1)<0.5,(B8>C8),-(C8>B8)))-TIME(0,30,0)
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try in D8 and copy down:

Code:
=IF(OR(B8="",C8=""),"",IF(MOD(C8-B8,1)*24>=8,(MOD(C8-B8,1)-TIME(0,30,0))*24,MOD(C8-B8,1)*24))
Format col D as a number with as many decimal places as you want.
 
Upvote 0
That worked, I cannot figure out the placement of the math for a simple conversion to hours and minutes, knowing that i multiply the total by 60 then divide that by 1440 it will give me hours and minutes as long as the cell is formatted for that, where in the world do I place that in the formula?
 
Upvote 0

Forum statistics

Threads
1,223,882
Messages
6,175,165
Members
452,615
Latest member
bogeys2birdies

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