PC Review


Reply
Thread Tools Rate Thread

Calculate the result of an array in vba

 
 
Sam
Guest
Posts: n/a
 
      11th Aug 2008
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


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      11th Aug 2008
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" & .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



Sam wrote:
>
> 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


--

Dave Peterson
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
is there any speed difference between a TVF CLR that returns an array vs yield as each result is ready? e.g. does returning the array all at once cause sql server to allocate more efficiently? DR Microsoft C# .NET 0 26th Nov 2007 10:59 PM
is there any speed difference between a TVF CLR that returns an array vs yield as each result is ready? e.g. does returning the array all at once cause sql server to allocate more efficiently? DR Microsoft Dot NET 0 26th Nov 2007 10:59 PM
is there any speed difference between a TVF CLR that returns an array vs yield as each result is ready? e.g. does returning the array all at once cause sql server to allocate more efficiently? DR Microsoft ADO .NET 0 26th Nov 2007 10:59 PM
is there any speed difference between a TVF CLR that returns an array vs yield as each result is ready? e.g. does returning the array all at once cause sql server to allocate more efficiently? DR Microsoft Dot NET Framework 0 26th Nov 2007 10:59 PM
Help with excel array - select, add and calculate result clk008@gmail.com Microsoft Excel Worksheet Functions 0 12th Jul 2007 06:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:39 PM.