【问题标题】:Adding up Excused time off in Attendance Tracker在出勤跟踪器中添加请假
【发布时间】:2014-09-01 06:04:51
【问题描述】:

我正在开发一个工作出勤跟踪器。除了一件事,我已经弄清楚了大部分。在员工为我们工作的第一年,每周最多可获得两个小时的“请假”。如果他们在所讨论的那一周有完美的出勤率,则可以获得一小时。如果他们在优先日上班,则可以获得第二个小时(即使他们迟到了)。我很难想出一种方法来检查这两个小时。我有一张表格,列出了从星期一开始的工作周数。

我想为完美出勤做的是在 A 列中查找任何出勤日期,该日期介于相关开始日期的一周和下周的开始日期(K 列)之间,然后检查它是否被列出在 E 列中没有任何理由。但我不知道如何设置它。

【问题讨论】:

    标签: excel excel-2010


    【解决方案1】:

    我已经重新排列了这些列并且没有使用所有这些列,因为我不确定其中一些与手头的问题有什么关系。 A、B、C 和 D 列是输入。我将“优先级”值从是/否更改为真/假。 “查找周”按钮激活以下宏以填充 E 列。

    Sub findweek()
    
    Dim absence As Integer: Dim week As Byte
    
    Range("E2:E100").ClearContents
    
        absence = 2 'find the first absence in column A
    
        week = 2    'find the first week in column B
    
            Do While Cells(absence, 1) <> 0 'loop through the absences in column A
    
                Do While Cells(week, 4) <> 0    'loop through weeks in column B
    
    'compare the date in column A to the begining of week in column B
    
                If Cells(absence, 1) > Cells(week, 4) Then
                    week = week + 1
                ElseIf Cells(absence, 1) = 0 Then
                    Exit Do
                Else
                    Cells(week - 1, 5) = Cells(absence, 1): absence = absence + 1: week = 2
                End If
    
                Loop    'count until you run out of "Mondays"
    
            Exit Do
            Loop    'count until you run out of "dates"
    
    End Sub
    

    F 列的值由以下内容填写:

    =IF(E2="",1,IF(VLOOKUP(E2,$A$2:$C$100,3,FALSE)=TRUE,2,0))
    

    单元格 G1 对 F 列中的值求和

    我希望这能让您了解如何设置项目。

    【讨论】:

      猜你喜欢
      • 2020-03-28
      • 2021-06-25
      • 1970-01-01
      • 2018-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多