I am trying to devise a non-vba Excel function which checks each cell in multiple ranges for different parameters and then returns the number of applicable occurrences. My specific problem occurs when applying the HOUR function to a range of date-cells and counting how many of these cells are equal to a certain hour.
To clarify, in VBA I would write something like (please assume that column A contains dates):
Sub tester33()
Dim r As Range
Dim c
Dim a As Integer
Set r = Range("A1:A10")
a = 0
For Each c In r
If (Hour(c) = 5) Then 'time is 5 am, other if conditions are omitted
a = a + 1
End If
Next c
MsgBox (a)
End Sub
What I would like to have working is
=COUNTIF(HOUR(A:A);"=5")
My search so far returned nada. Please note that I found answers to this question here and here, that unfortunately won't work for nonmathematical Excel functions. I hope this isn't a completely trivial problem, as I am new to in-sheet formulas.