Assuming you have named ranges "myrange1", "myrange2", and "myrange3" and they are all the same size..
Sub RangeCompare()
Dim r1 As Range
Dim r2 As Range
Dim r3 As Range
Set r1 = Range(ThisWorkbook.Names("myrange1").RefersTo)
Set r2 = Range(ThisWorkbook.Names("myrange2").RefersTo)
Set r3 = Range(ThisWorkbook.Names("myrange3").RefersTo)
MsgBox "Matching count is " & CountMatch(r1, r2, r3)
End Sub
Function CountMatch(r1 As Range, r2 As Range, r3 As Range) As Integer
Dim i As Integer
Dim n As Integer
n = r1.Cells.Count
For i = 1 To n
If r1.Cells(i) = "yes" And r2.Cells(i) = "no" And r3.Cells(i) = "yes" Then CountMatch = CountMatch + 1
Next i
End Function
Regards, AB
Bookmarks