Dim LR As Long
Dim strFrm As String
LR = Sheets("DBformat").Cells(Rows.count, 5).End(xlUp).row
strFrm = "=COUNTIFS(DBformat!$F$1:$F$@LR;B$1,DBformat!$E$1:$E$@LR,$A2)"
Cells(2, 2).Resize(Cells(Rows.count, 2).End(xlUp).row - 1).Formula = Replace(strFrm, "@LR", LR)