I am using VBA in Excel 2011 (but saving to Excel 97 - 2004) to count all matching values in column C where the value is training
. To do this I am using the following code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then
Dim r As Range
Dim c
Set r = Sheets("Sheet2").Range("C:C")
c = Application.WorksheetFunction.CountIf(r, "training")
MsgBox "column C has " & c & " instances of 'training'"
End If
End Sub
What I would like to do however is create a CountIfs statement that allows me to check if value "training" exists in column C and if the value 10
exists in another Column B and if both match within the same row then count all the rows where both values exist, otherwise do not count.
Would someone please be able to help me solve this?