Minus time if in a certain range

DonnaA

New Member
Joined
Mar 10, 2023
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I'm creating a timesheet that tracks time worked on each work order and I need to build a formula that will automatically deduct the 1/2 lunch break if any of those times entered are within the 12:00 pm to 12:30 pm range.
I tried uploading the add on tool so I could upload a Mini-sheet but I can't seem to add it under developer to my add ins. I went in to properties to tell the my system the program was safe but just says it can't open in protected view but my sheet isn't in protected view ?

TIA for any help :)
 

Attachments

  • TimeSheet Example.png
    TimeSheet Example.png
    67.3 KB · Views: 20

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
This will subtract 1/2 hour if the start time is before 12:00 and the finish time is after 12:30. It does not take into account times that start or end during lunch break.

(How did you populate the values in your screenshot?)

$scratch.xlsm
ABCD
1StartFinishTimeTime - Breaks
28:00 AM10:00 AM2.02.0
39:30 AM4:30 PM7.06.5
42:30 PM4:30 PM2.02.0
times
Cell Formulas
RangeFormula
C2:C4C2=24*(B2-A2)
D2:D4D2=24*(B2-A2)-IF(AND(A2<TIMEVALUE("12:00 PM"),B2>TIMEVALUE("12:30 PM")),0.5,0)
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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