It is my final approach. (again there was no attachment reflecting REAL data layout :-( I believe it is fair if you put more effort and answering person donates knowledge).
If it works - perfect (not tested as there was no attachment with such data layout).
If not - my suggestion is to try: https://www.excelforum.com/payments.php
Note that it's user responsibility to use proper ranges (for instance same row number in condition_range and input_range).
Function countif_from_cond(input_range As Range, cond_range as Range, counted As Variant, cond As Variant) As Long
Dim myarr, condarr, i As Long, j As Long, k As Long, colno As Long
myarr = input_range.Value
condarr = cond_range.Value
colno = UBound(myarr, 2)
i = UBound(myarr)
Do
For k = 1 To colno
If myarr(i, k) = counted Then j = j + 1
Next k
i = i - 1
Loop Until condarr(i + 1, 1) = cond Or i <= 0
countif_from_cond = j
End Function
sample usage:
Formula:
=countif_from_cond($B$3:$C3,$A$3:$A3,B3,1)
values in columns B:C, cond in column A
Bookmarks