Count the matches in two excel columns

[Closed]
Report
-
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
-
Hello,
I am trying to compare the numbers in e82:i83 to numbers in e109:n110 and count the number of matches with the total to show in another cell, n82. I am running windows XP and Excel 97. It seems simple to me but I have tried everything I know and have read with no satisfactory results. Any help is appreciated.

3542

1 reply

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
802
I wonder whether your ranges are correct. The two ranges
overlap.

any how I have given the macro. change to correct ranges.

Sub test()
Dim r As Range, r1 As Range, c As Range, j As Integer
Dim cfind As Range
Range("N82").Clear
Set r = range("E82:I183")
Set r1 = range("E109:N110")
For Each c In r
Set cfind = r1.Cells.Find(what:=c.Value, lookat:=xlWhole)
If Not cfind Is Nothing Then j = j + 1
Next c
Range("N82") = j
End Sub