david000
01-18-2017, 07:50 PM
Tenth
Rounded
Clock
Tenth
Rounded
Clock
of Hr
Time
Range
of Hr
Time
Range
0
:00
:58-:03
0.5
:30
:28-:33
0.1
:06
:04-:09
0.6
:36
:34-:39
0.2
:12
:10-:15
0.7
:42
:40-:45
0.3
:18
:16-:21
0.8
:48
:46-:51
0.4
:24
:22-:27
0.9
:54
:52-:57
I want to round times like the above chart, but I'm having a really hard time with this. I need some incite into the workings of payroll clocks etc...
Public Function ROUNDTIME(MIN As Variant) As Variant
Application.Volatile
Select Case MIN
Case 1 To 3: ROUNDTIME = 0
Case 4 To 9: ROUNDTIME = 0.1
Case 10 To 15: ROUNDTIME = 0.2
Case 16 To 21: ROUNDTIME = 0.3
Case 22 To 27: ROUNDTIME = 0.4
Case 28 To 33: ROUNDTIME = 0.5
Case 34 To 39: ROUNDTIME = 0.6
Case 40 To 45: ROUNDTIME = 0.7
Case 46 To 51: ROUNDTIME = 0.8
Case 52 To 57: ROUNDTIME = 0.9
Case Else: ROUNDTIME = 0
End Select
End Function
I have a time system with a scheduler and I have a punch out time that indicates they worked over like, 2 pm to 10 pm = 8.0 , then if they work and extra 4 min I can use my formula to add the appropriate rounded minutes but it fails badly at the half hour.
Any help would be great!
Edit: The attachment is a bit confusing, what I want is the user to be able to ENTER the in/out times from the clock and my custom function or whatever rounds to the correct decimal adding the two together. Their scheduled hours and their actual hours worked.
For example the int portion of 2pm to 10 pm is 8 and the decimal portion could be 0.1 if they punched out between 4 minutes to 9 minutes after their scheduled time. Together they are 8.1 that's good, and I get that far, but times that are starting and ending at the half hour give me trouble, like this 130 pm to 930 pm is 8.0 if they punch out at 936 I want to add 6 minutes not 36 minute like this, 8.1 NOT 8.6.
Thanks.
Rounded
Clock
Tenth
Rounded
Clock
of Hr
Time
Range
of Hr
Time
Range
0
:00
:58-:03
0.5
:30
:28-:33
0.1
:06
:04-:09
0.6
:36
:34-:39
0.2
:12
:10-:15
0.7
:42
:40-:45
0.3
:18
:16-:21
0.8
:48
:46-:51
0.4
:24
:22-:27
0.9
:54
:52-:57
I want to round times like the above chart, but I'm having a really hard time with this. I need some incite into the workings of payroll clocks etc...
Public Function ROUNDTIME(MIN As Variant) As Variant
Application.Volatile
Select Case MIN
Case 1 To 3: ROUNDTIME = 0
Case 4 To 9: ROUNDTIME = 0.1
Case 10 To 15: ROUNDTIME = 0.2
Case 16 To 21: ROUNDTIME = 0.3
Case 22 To 27: ROUNDTIME = 0.4
Case 28 To 33: ROUNDTIME = 0.5
Case 34 To 39: ROUNDTIME = 0.6
Case 40 To 45: ROUNDTIME = 0.7
Case 46 To 51: ROUNDTIME = 0.8
Case 52 To 57: ROUNDTIME = 0.9
Case Else: ROUNDTIME = 0
End Select
End Function
I have a time system with a scheduler and I have a punch out time that indicates they worked over like, 2 pm to 10 pm = 8.0 , then if they work and extra 4 min I can use my formula to add the appropriate rounded minutes but it fails badly at the half hour.
Any help would be great!
Edit: The attachment is a bit confusing, what I want is the user to be able to ENTER the in/out times from the clock and my custom function or whatever rounds to the correct decimal adding the two together. Their scheduled hours and their actual hours worked.
For example the int portion of 2pm to 10 pm is 8 and the decimal portion could be 0.1 if they punched out between 4 minutes to 9 minutes after their scheduled time. Together they are 8.1 that's good, and I get that far, but times that are starting and ending at the half hour give me trouble, like this 130 pm to 930 pm is 8.0 if they punch out at 936 I want to add 6 minutes not 36 minute like this, 8.1 NOT 8.6.
Thanks.