Как уже говорилось, я думаю, что VBA является единственным решением.Поместите это в модуль, прикрепленный к книге.
Function vcount(v1 As Range, v2 As Range, vyr As Range, pRng As Range, pyr As Range) As Long
vcount = -1
Dim pArr As Variant
pArr = pRng.Value
Dim pyrArr As Variant
pyrArr = pyr.Value
If UBound(pArr, 1) <> UBound(pyrArr, 1) Then Exit Function
Dim temp As Long
temp = 0
Dim i As Long
For i = LBound(pArr, 1) To UBound(pArr, 1)
Dim v1B As Boolean
v1B = False
Dim v2B As Boolean
v2B = False
Dim j As Long
For j = LBound(pArr, 2) To UBound(pArr, 2)
If pArr(i, j) = v1 Then v1B = True
If pArr(i, j) = v2 Then v2B = True
Next j
If v1B And v2B And pyrArr(i, 1) < vyr Then temp = temp + 1
Next i
vcount = temp
End Function
Тогда вы бы назвали его обычной формулой:
=vcount(A2,B2,C2,$G$2:$I$5,$J$2:$J$5)
