+ Reply to Thread
Results 1 to 4 of 4

Sumproduct from array

  1. #1
    Registered User
    Join Date
    09-29-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    77

    Sumproduct from array

    Hi,

    I'm currently pulling through data from SQL and holding it in an array. What I want to do is write a line of code that will Sumproduct Column 3 againts Column 4 and return the value to a cell (say A1)

    If anybody could advise me with this method it would be much appreciated as I'm a bit stuck.

    Thanks in Advance

    Macro1
    Last edited by Macro1; 04-08-2010 at 09:41 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Sumproduct from array

    Perhaps

    Please Login or Register  to view this content.
    where vArray is your Array.

  3. #3
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: Sumproduct from array

    If you are using the ADO method GetRows to populate your array, just be aware that it reverses the 'normal' excel order of 2D arrays of 1st dimension being rows, 2nd being columns, so you may need to swap the row/column indices around in DO's code.

    Why don't you perform this calculation actually within the SQL itself?
    Richard Schollar
    Microsoft MVP - Excel

  4. #4
    Registered User
    Join Date
    09-29-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Sumproduct from array

    Thanks Guys,

    To be honest I didn't even think to perform the task in SQL, it seemed obvious after I read your reply.

    Thanks Again

+ 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