나는 열을 재 배열하고 나는 약간 손 질문에 관련된 방법을 잘하지 않았다으로, 그들 모두를 사용하지 않았다. 열 A, B, C 및 D는 입력입니다. "Priority"값을 yes/no에서 True/False로 변경했습니다. 열 F에
=IF(E2="",1,IF(VLOOKUP(E2,$A$2:$C$100,3,FALSE)=TRUE,2,0))
셀 G1 합계 값 : F 열은 다음에 의해 채워집니다위한 "주 찾기"버튼 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
값을 채우기 위해 다음 매크로를 활성화
이 방법을 사용하면 프로젝트 설정 방법을 알 수 있기를 바랍니다.