I believe that the problem is that, when you enter the formula in the Workbook,
you're entering it as an ARRAY formula, where it matches the value in Column A
and column B is EITHER 12 or 13 ({12,13})
But in your VBA, you're only counting a match of 12:
Sheet2.Cells(i, 2) =
Or another alternative
=SUMPRODUCT((Sheet1!$A$2:$A$2270=A2)*((Sheet1!$B$2:$B$2270=12)+(Sheet1!$B$2:$B$2270=13)))
Sub cnt()
Dim rng As Range
Dim rng1 As Range
Dim i As Integer
Set rng = Sheet1.Range(A2:A Sheet1.Range(A
Rows.Count).End(xlUp).Row)
Set rng1 = Sheet1.Range(B2:B Sheet1.Range(B