Calculating incorret time recording

Damoo

New Member
Joined
Jan 8, 2019
Messages
2
Name

Org
Day
Start
End
Minutes
Incorrect
Person 1
A
Monday
5:05 pm
6:00 pm
0:55
0:25
Person 2
B
Tuesday
5:05 pm
5:15 pm
0:10
0:10
Person 3
C
Saturday
6:15 am
2:50 pm
8:35
0:00

<tbody>
</tbody>







Hello all,

Hoping someone can provide some assistance with creating an excel formula.

I have a whole heap of data of when people have worked overtime but I know some is incorrect and I need to capture those incorrect entries.

Basic rule is cannot work overtime between 5:30 am and 5:30 pm from Monday to Friday.

So, from the data above, Person 1 claimed 55 minutes of overtime but 25 was incorrect (between 5:30 and 5:30), person 2 claimed 10 minutes which was all incorrect, Person 3's was on Saturday so theirs is fine.

I need a formula that will calculate the incorrect minutes.

Thanks in advance for any assistance.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Welcome to the forum.

I mocked this up for you. Let us know if it is on track or not. Note that the Dates are formatted as Excel Time-Dates and not just text like "Monday". Note especially that this won't function for overnight shifts.

Copy F2 to I2 down as needed.

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
Book1
ABCDEFGHIJKL
1NameOrgDateStartEndOTClaimedIncorrectcondition
2Person 1AMon 1/07/1917:0518:000:300:550:25over-claimedregular start5:30
3Person 2BTue 1/08/1917:0517:150:000:100:10over-claimedregular end17:30
4Person 3CSat 1/12/196:1514:508:358:350:00ok
5Person 4CMon 1/14/193:0011:002:300:002:30underclaimed
6Person 5CSun 1/20/194:1521:0016:4516:300:15underclaimed
7Person 6CThu 1/24/193:0020:155:157:152:00over-claimed
Sheet3
Cell Formulas
RangeFormula
H2=MAX(G2-F2,F2-G2)
I2=IF(G2>F2,"over-claimed",IF(F2>G2,"underclaimed","ok"))
F2=IF(OR(WEEKDAY(C2,2)=6,WEEKDAY(C2,2)=7),E2-D2,MAX(E2-$L$3,0)+MAX($L$2-D2,0))
[/FONT]
 
Upvote 0
Thanks so much for your help, I incorporated your suggested formulas into my workbook and everything was working swimmingly until I came across this one where the shift begins and ends outside regular times:

Start Time = 19:00
End Time =19:30

I get an OT result of 2 hours as the formula is subtracting the regular end time from the actual end time.
Then get the correct claimed time of 30 minutes and an incorrect incorrect result of 1:30 and an incorrect condition of underclaimed.

Thoughts on how to modify the formula so that those times starting and finishing outside regular times are a basic E#-D# formula?

Thanks again for your help.

Cheers
 
Upvote 0
I mistakenly thought each workman would at least work during the regular hours during the week. So this should account for workmen who have an early AM shift or a late PM shift.

F2:
Code:
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]=IF(OR(WEEKDAY(C2,2)=6,WEEKDAY(C2,2)=7,AND(D2<$L$2,E2<$L$2),AND(D2>$L$3,E2>$L$3)),E2-D2,MAX(E2-$L$3,0)+MAX($L$2-D2,0))[/FONT]
 
Upvote 0

Forum statistics

Threads
1,213,514
Messages
6,114,078
Members
448,547
Latest member
arndtea

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