Non VBA solution:
=SUMPRODUCT(COUNTIF($K$7:$V$10,$D7:$AH7))
VBA solution:
Founds how many times values from rng1
appears in rng2
:
Can it ignore blanks?
UPD:
Function countEntries(rng1 As Range, rng2 As Range) As Long
Dim arr1, arr2, a1, a2
arr1 = rng1.Value
arr2 = rng2.Value
For Each a1 In arr1
If Trim(a1) <> "" Then
For Each a2 In arr2
If a2 = a1 Then
countEntries = countEntries + 1
Exit For
End If
Next
End If
Next
End Function
call it like this: =countEntries($D7:$AH7,$K$7:$V$10)
.
P.S. I use loop for determining whether array contains value or not rather than Application.Match/Application.CountIf
because it's up to 10 times faster. See this link for details: Matching values in string array