Automatically deducting 45 min breaks from time range

bchew

New Member
Joined
Aug 2, 2016
Messages
5
Hi there

I am currently using the following to calculate time range in one column:

=IF(ISNUMBER(FIND("/",C5)),0.5+MOD(SUBSTITUTE(RIGHT(C5,5),"-","")-SUBSTITUTE(MID(C5,FIND("/",C5)+1,5),"-",""),-0.5),0)+0.5+MOD(SUBSTITUTE(MID(C5,FIND("-",C5)+1,5),"/","")-SUBSTITUTE(LEFT(C5,5),"-",""),-0.5)



However am having trouble figuring out how to automatically deduct 45 minute breaks off any shift that is above 5 hours.
:confused:

I know that it would be much simpler splitting up the shift into two columns but I am interested in finding out if there is a way to modify the current sheet than create a new one.

Any advice is much appreciated.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
=if(isnumber(find("/",c5)),0.5+mod(substitute(right(c5,5),"-","")-substitute(mid(c5,find("/",c5)+1,5),"-",""),-0.5),0)+0.5+mod(substitute(mid(c5,find("-",c5)+1,5),"/","")-substitute(left(c5,5),"-",""),-0.5)-if(if(isnumber(find("/",c5)),0.5+mod(substitute(right(c5,5),"-","")-substitute(mid(c5,find("/",c5)+1,5),"-",""),-0.5),0)+0.5+mod(substitute(mid(c5,find("-",c5)+1,5),"/","")-substitute(left(c5,5),"-",""),-0.5)>5/24,0.75/24,0)
 
Upvote 0
=if(isnumber(find("/",c5)),0.5+mod(substitute(right(c5,5),"-","")-substitute(mid(c5,find("/",c5)+1,5),"-",""),-0.5),0)+0.5+mod(substitute(mid(c5,find("-",c5)+1,5),"/","")-substitute(left(c5,5),"-",""),-0.5)-if(if(isnumber(find("/",c5)),0.5+mod(substitute(right(c5,5),"-","")-substitute(mid(c5,find("/",c5)+1,5),"-",""),-0.5),0)+0.5+mod(substitute(mid(c5,find("-",c5)+1,5),"/","")-substitute(left(c5,5),"-",""),-0.5)>5/24,0.75/24,0)

Thank you so very much! You made my day.
 
Upvote 0
Another speed hump now. As the cells with the times have to be formatted as "time" cells, my column which does the totalling doesn't work anymore (it used to be just a regular calculation and worked ok then)

=SUM(SUMIF(C5:P5,{"<12:00",">1:00"}))

I have used sum if to omit the columns without values (ie no shift) but it wouldn't present the proper sum now.

Is there a way around this please.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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