Edit Existing VBA to subtract .5 for lunch each if total hours are 6.5 or greater each day

cal5859

New Member
Joined
Apr 20, 2018
Messages
1
We purchased a time clock, and the time clock company supplied us with a macro that total the daily hours as well as the total hours for any date range that we choose. Our company policy is if an employee works 6.5 or more hours per day, we subtract .5 hours from that days hours for lunch. I would like to edit the code to perform this action while calculating the hours.
HERE IS A COPY OF THE TIME CLOCK PUNCH REPORT THAT GENERATES FroM OUR TIME CLOCK
[TABLE="width: 709"]
<tbody>[TR]
[TD="colspan: 14"]Time Card Report[/TD]
[/TR]
[TR]
[TD="colspan: 14"]10/1/2015 - 10/30/2015[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"]Downloaded:[/TD]
[TD="colspan: 2"]10/27/2015 02:34 PM[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]No: 496386[/TD]
[TD="colspan: 4"]Name: NAME[/TD]
[TD="colspan: 2"]Dept:[/TD]
[TD="colspan: 2"]Shift: NULL[/TD]
[TD="colspan: 4"]Daily totals[/TD]
[/TR]
[TR]
[TD]Date[/TD]
[TD]Week[/TD]
[TD](IN)[/TD]
[TD](OUT)[/TD]
[TD](IN)[/TD]
[TD](OUT)[/TD]
[TD](IN)[/TD]
[TD](OUT)[/TD]
[TD](IN)[/TD]
[TD](OUT)[/TD]
[TD]Regular Hours[/TD]
[TD]OT Hours[/TD]
[TD]Other Hours[/TD]
[TD]Notes[/TD]
[/TR]
[TR]
[TD]10/01[/TD]
[TD]THU[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
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][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/09[/TD]
[TD]FRI[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/10[/TD]
[TD]SAT[/TD]
[TD]5:55[/TD]
[TD]14:58[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/11[/TD]
[TD]SUN[/TD]
[TD]5:58[/TD]
[TD]14:58[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/12[/TD]
[TD]MON[/TD]
[TD]5:57[/TD]
[TD]14:49[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/13[/TD]
[TD]TUE[/TD]
[TD]0:00[/TD]
[TD]0:00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/14[/TD]
[TD]WED[/TD]
[TD]14:24[/TD]
[TD]21:01[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/15[/TD]
[TD]THU[/TD]
[TD]14:15[/TD]
[TD]20:15[/TD]
[TD][/TD]
[TD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/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/29[/TD]
[TD]THU[/TD]
[TD]0:00[/TD]
[TD]0:00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/30[/TD]
[TD]FRI[/TD]
[TD]0:00[/TD]
[TD]0:00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]TOTAL:[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 3"]Work Total (hrs):[/TD]
[TD][/TD]
[TD="colspan: 2"]Overtime (hrs)[/TD]
[TD][/TD]
[TD="colspan: 2"]Other (hrs):[/TD]
[TD][/TD]
[TD="colspan: 2"]Total (hrs):[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 5"]Employee Signature:[/TD]
[TD="colspan: 5"]Manager Signature:[/TD]
[TD="colspan: 4"]Date:[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]No: 490794[/TD]
[TD="colspan: 4"]Name: NAME[/TD]
[TD="colspan: 2"]Dept:[/TD]
[TD="colspan: 2"]Shift: NULL[/TD]
[TD="colspan: 4"]Daily totals[/TD]
[/TR]
[TR]
[TD]Date[/TD]
[TD]Week[/TD]
[TD](IN)[/TD]
[TD](OUT)[/TD]
[TD](IN)[/TD]
[TD](OUT)[/TD]
[TD](IN)[/TD]
[TD](OUT)[/TD]
[TD](IN)[/TD]
[TD](OUT)[/TD]
[TD]Regular Hours[/TD]
[TD]OT Hours[/TD]
[TD]Other Hours[/TD]
[TD]Notes[/TD]
[/TR]
[TR]
[TD]10/01[/TD]
[TD]THU[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/02[/TD]
[TD]FRI[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/03[/TD]
[TD]SAT[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/04[/TD]
[TD]SUN[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/05[/TD]
[TD]MON[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10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[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/27[/TD]
[TD]TUE[/TD]
[TD]6:24[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/28[/TD]
[TD]WED[/TD]
[TD]0:00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/29[/TD]
[TD]THU[/TD]
[TD]0:00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10/30[/TD]
[TD]FRI[/TD]
[TD]0:00[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]TOTAL:[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 3"]Work Total (hrs):[/TD]
[TD][/TD]
[TD="colspan: 2"]Overtime (hrs)[/TD]
[TD][/TD]
[TD="colspan: 2"]Other (hrs):[/TD]
[TD][/TD]
[TD="colspan: 2"]Total (hrs):[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 5"]Employee Signature:[/TD]
[TD="colspan: 5"]Manager Signature:[/TD]
[TD="colspan: 4"]Date: [/TD]
[/TR]
</tbody>[/TABLE]

HERE IS THE VBA CODE TO CALCULATE THE HOURS


Code:
' BioTouch Totals


Const FirstPunchColumn = 3
Const cTotalsColumn = 11


Sub CalculateTimeCards()
    formGetFormat.Show
End Sub


Sub CalcTimeCards(bHundredths As Boolean)
    'Application.ScreenUpdating = False
    
    Dim nRow As Integer
    Dim dtIn As Date
    Dim dtOut As Date
    Dim dDayTotal As Double
    Dim dPeriodTotal As Double
    Dim bOut As Boolean


    On Error GoTo ErrorHandler
    
    BlankCount = 0
    nRow = 4
    With Worksheets("Sheet1")
        Do While BlankCount < 10
            If .Cells(nRow, 1) = "" Then
                BlankCount = BlankCount + 1
            Else
                If Left(.Cells(nRow, 1), 3) = "No:" Then
                    BlankCount = 0
                    dPeriodTotal = 0
                    ' Get the punch data
                    nRow = nRow + 2
                    
                    Do While Trim(.Cells(nRow, 1)) <> ""
                        nCol = FirstPunchColumn
                        dDayTotal = 0
                        bOut = False
                        If Trim(.Cells(nRow, nCol)) = "" Then
                            .Cells(nRow, cTotalsColumn) = ""
                        Else
                            ' Iterate the timecard columns
                            Do While Trim(.Cells(nRow, nCol)) <> ""
                                ' Get the punch
                                If Not bOut Then
                                    dtIn = .Cells(nRow, nCol)
                                    bOut = True
                                Else
                                    dtOut = .Cells(nRow, nCol)
                                    dDayTotal = dDayTotal + (dtOut - dtIn)
                                    If dtOut < dtIn Then
                                        ' Crossed midnight. Add a day
                                        dDayTotal = dDayTotal + 1
                                    End If
                                    bOut = False
                                End If
                                nCol = nCol + 1
                            Loop
                            If Not bOut Then
                                If bHundredths Then
                                    .Cells(nRow, cTotalsColumn).NumberFormat = "0.00"
                                    .Cells(nRow, cTotalsColumn) = 24 * dDayTotal
                                Else
                                    .Cells(nRow, cTotalsColumn).NumberFormat = "[h]:mm"
                                    .Cells(nRow, cTotalsColumn) = HoursAndMins(dDayTotal)
                                End If
                                dPeriodTotal = dPeriodTotal + dDayTotal
                            Else
                                .Cells(nRow, cTotalsColumn) = "MP"
                            End If
                        End If
                        nRow = nRow + 1
                    Loop
                    .Cells(nRow, cTotalsColumn).HorizontalAlignment = xlCenter
                    If bHundredths Then
                        .Cells(nRow, cTotalsColumn).NumberFormat = "0.00"
                        .Cells(nRow, cTotalsColumn) = 24 * dPeriodTotal
                    Else
                        .Cells(nRow, cTotalsColumn).NumberFormat = "[h]:mm"
                        .Cells(nRow, cTotalsColumn) = HoursAndMins(dPeriodTotal)
                    End If
                End If
            End If
            nRow = nRow + 1
        Loop
    End With
    Application.ScreenUpdating = True
Exit Sub
ErrorHandler:
    MsgBox "Problem accessing the Time Card Spreadsheet. Make sure that the time cards are opened in the same " & _
        "Excel instance as this macro", vbOKOnly, "Error"
Exit Sub
End Sub




Function HoursAndMins(ByVal d As Double) As String
    Dim Hours As Integer
    Dim Min As Integer
    Dim str1 As String
        
    d = d * 24
    Hours = Int(d)
    Min = Round((d - Hours) * 60, 0)
    If Len(Min) < 2 Then
        HoursAndMins = Hours & ":0" & Min
    Else
        HoursAndMins = Hours & ":" & Min
    End If
End Function
 
Last edited by a moderator:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,223,885
Messages
6,175,180
Members
452,615
Latest member
bogeys2birdies

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