+ Reply to Thread
Results 1 to 2 of 2

using excel array functions on part of array

Hybrid View

  1. #1
    Registered User
    Join Date
    07-09-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    18

    using excel array functions on part of array

    say I have arrays ArrA and ArrB, of lengths x and y.

    I know I can write, say,

    Application.WorksheetFunction.SumProduct(ArrA,ArrB)
    to get the sumproduct off the two arrays. however, say i want to sumproduct of just the first z elements of the arrays. is there a neat way of getting this?

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: using excel array functions on part of array

    try something like this

    Sub test()
    Dim arra As Range, arrb As Range, rnga As Range, rngb As Range
    Dim j As Double
    Set arra = Range(Range("a1"), Range("a1").End(xlDown))
    Set arrb = Range(Range("b1"), Range("B1").End(xlDown))
    
    
    Set rnga = arra.Resize(3, 1)
    Set rngb = arrb.Resize(3, 1)
    
    MsgBox rnga.Address
    j = WorksheetFunction.SumProduct(rnga, rngb)
    MsgBox j
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1