Calculate the result of an array in vba

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

For Each c In Range("A2", Range("A2").End(xlDown))
I would like vba to enter the result of the following array formula into
column P in each row:

{=SUM((A$2:A$1000=A2)*(F$2:F$1000=F2)*G$2:G$1000)}

I would like to do this without actually entering the formula -- only the
value.

Any help would be appreciated.

Thanks,

Sam
 
I'd add the formulas and then convert them to values.

If you blink, you may not even notice the formulas!

Option Explicit
Sub testme()

Dim myRng As Range
With ActiveSheet
Set myRng = .Range("p2:p" & .Range("a2").End(xlDown).Row)
End With

With myRng
.Formula = "=SUMproduct((A$2:A$1000=A2)*(F$2:F$1000=F2)*G$2:G$1000)"
.Value = .Value
End With
End Sub
 
Back
Top