COUNTBETWEEN

Counts number of values between num1 and num2


Function COUNTBETWEEN(InRange, num1, num2) As Integer 

    Dim TheCount As Integer
    Dim cell As Range
    Set InRange = Intersect(InRange.Parent.UsedRange, InRange)
    TheCount = 0
    For Each cell In InRange
        If cell.Value >= num1 And _
          cell.Value <= num2 Then TheCount = TheCount + 1
    Next cell
    COUNTBETWEEN = TheCount
End Function


© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext