Sub celia()
For j = 2 To 4
For i = 2 To 94
If Sheet1.Cells(i, 1) = Sheet2.Cells(j, 1) Then
myCount = myCount + 1
End If
Next
Sheet2.Cells(j, 2) = myCount
Next
End Sub
Sub natenie()
For i = 2 To 94
myCount = Application.WorksheetFunction.CountIf(Sheet1.Rows(i), 0) + Application.WorksheetFunction.CountIf(Sheet1.Rows(i), "外出")
If myCount = 1 Or myCount = 2 Or myCount = 3 Or myCount = 4 Then Sheet1.Cells(i, 8) = 1
Next
End Sub
Sub four()
For j = 2 To 4
myCount = 0
For i = 2 To 94
If Sheet1.Cells(i, 1) = Sheet2.Cells(j, 1) And Sheet1.Cells(i, 8) = 1 Then
myCount = myCount + Application.WorksheetFunction.CountIf(Sheet1.Rows(i), 1): Sheet2.Cells(j, 3) = myCount
End If
Next
Next
End Sub