Help to find control logic - Employee hours control

Qete_ARG

Board Regular
Joined
Oct 20, 2005
Messages
72
Hi everybody, I am trying to find a way to calculate the amount of hours worked by every employee. Each employee must chek in and out 2 times a day (we get one hour to lunch).
The trick here is to find a way to calculate the amount of hours worked during the morning and the afternoon, but I cannot use the column named "Item". It is not trustable.
For example, on march 11th the employee checked out at 17:57 but one time as "In" and one time as "Out", and on march 31st the employee didn´t check in but checked out at noon.
I was trying to figure out a way to control this by a formula, but I have not been able to find the way to do it!!
If someone here could give me a hand, I would be really appreciatted.


Excel Workbook
ABCDEFG
31EmployeeIdEMployeesNameDateItemDayNumberMonthNumberYear
32111222333Employee110/03/2010 08:19In1032010
33111222333Employee110/03/2010 13:01Out1032010
34111222333Employee110/03/2010 13:43In1032010
35111222333Employee110/03/2010 18:01Out1032010
36111222333Employee111/03/2010 08:33In1132010
37111222333Employee111/03/2010 13:07Out1132010
38111222333Employee111/03/2010 14:06In1132010
39111222333Employee111/03/2010 17:57In1132010
40111222333Employee111/03/2010 17:57Out1132010
41111222333Employee131/03/2010 12:59Out3132010
42111222333Employee131/03/2010 13:58In3132010
43111222333Employee131/03/2010 18:00Out3132010
Hoja2
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
No formula is going to give you a good solution for examples like the one where they checked out, without checking in first.

At best, I would suggest getting a formula to highlight data with a problem, which would then prompt manual intervention.
 
Upvote 0
You are right....I was afraid I was gonna have to think of a VBA solution in order to get this done...Do you think with VBA would be plausible? I will have to take off the dust to my little VBA experience and give it a try!
Thanks for your response!
 
Upvote 0
Sorry, instead of "No formula ..." I should have said "No computer programme ...", including VBA.

If you can't rely on the data, I don't see how you can write any kind of programme to deal with the data correctly.
The best you can do, I think, is highlight data that doesn't meet (a) certain pattern(s).
For example, you might say,
IF an employee has exactly 4 transactions on a certain date, assume the data is correct, and calculate the hours
ELSE flag that that employee / date combination has data that looks incorrect, and requires manual intervention.
The way I've seen this done in practice is you ask the person what time they actually started that day. But you can't expect a computer to work that out.

This in itself would not cover situations like this...
Let's say the employee does NOT clock in first thing in the morning (like they did on 31st March), they then clock out at lunchtime, back in after lunch, and then in AND out at 17:57, like they did on 11th March.
In this situation, you would have 4 clocking on/off events, and it would not be highlighted by the test I outlined above. But the data is clearly wrong.
So you could add another rule to say, for example, highlight any occasions when there are two or more clocking events within a minute of each other (or within 5 minutes, or 10 minutes, or whatever is appropriate to your situation), and prompt manual intervention.

There may possibly be other errors in the data that you might want to try and trap as well.
 
Upvote 0
I am really appreciatted with you for taking the time to give me an opinion.
I agree that the best solution is to flag the days that need some user intervention in order to analize them. I was afraid this was the only solution, and I confirm it is!!
:(
Thanks a lot!!
Miguel
 
Upvote 0
Miguel

I agree with Gerald, though you might be able to restrict what people enter using some data validation.

That could get a bit complicated mind you, so perhaps best to just highlight problems.
 
Upvote 0
Hi Norie, thanks for resplying!
The thing is that this data is taken from the fingerprint reader where all the employees check in and out...so I am not able to restrict user input.
But thanks anyway!
 
Upvote 0

Forum statistics

Threads
1,215,374
Messages
6,124,574
Members
449,173
Latest member
Kon123

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