I want to include the following array formula in my code but get an object defined error?

Range("AV3:AV" & SecondLastRow - 1) = "={SUM(COUNTIFS(J:J,AT3,C:C,ExcludeCT))}"
Thanks in advance