Calculate the result of an array in vba

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
 
D

Dave Peterson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top