Microsoft Excel - Macros - Count - Count Sequentially

' Returns the number of vCrit found within the array oArrWithCrit.
Function ArrayCountIfSequential(oArrWithCrit As Variant, vCrit As Variant)
    Dim lRow As Long
 
    For lRow = LBound(oArrWithCrit, 1) To UBound(oArrWithCrit, 1)
        If oArrWithCrit(lRow, 1) = vCrit Then
            ArrayCountIfSequential = ArrayCountIf + 1
        End If
    Next
End Function

or

'=ArrayCountIf(A1:A1000,"Foo",B1:B1000)
Function RangeCountIf(oRngWithCrit As Range, vCrit As Variant)
    Dim vArr1 As Variant
    Dim lRow As Long
 
    vArr1 = oRngWithCrit.Value
    For lRow = LBound(vArr1, 1) To UBound(vArr1, 1)
        If vArr1(lRow, 1) = vCrit Then
            RangeCountIf = RangeCountIf + 1
        End If
    Next
 
 
    ' Clear all objects.
    Set vArr1 = Nothing
 
End Function