Не проверено - вы должны получить общий шаблон ...
With ThisWorkbook.Sheets(1)
.Range("D5").Value = Counts("RDG1", "PW", "Sewer Works")
.Range("E5").Value = Counts("RDG1", "PW", "Sewer Works", "PASS")
.Range("F5").Value = Counts("RDG1", "PW", "Sewer Works", "FAIL")
'other counts here
End With
'Get row counts from sheet2
' Optional 4rd parameter for PASS/FAIL
Function Counts(v1 As String, v2 As String, v3 As String, Optional v4 As String = "") As Long
Dim rng1 As Range, rng2 As Range, rng3 As Range, rng4 As Range
With ThisWorkbook.Sheets(2)
Set rng1 = .Range("C7:C10000")
Set rng2 = .Range("D7:D10000")
Set rng3 = .Range("G7:G10000")
Set rng4 = .Range("I7:I10000")
If Len(v4) > 0 Then
Counts = Application.CountIfs(rng1, v1, rng2, v2, rng3, v3, rng4, v4)
Else
Counts = Application.CountIfs(rng1, v1, rng2, v2, rng3, v3)
End If
End With
End Function