+ Reply to Thread
Results 1 to 4 of 4

Using SumProduct Worksheet Function in VBA

  1. #1
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208

    Using SumProduct Worksheet Function in VBA

    Hi Guys.

    I'm having a hard time figuring out how to use the SumProduct worksheet function in VBA. The below worksheet formula works:

    =SUMPRODUCT((accProv=D2)*(accFYE=E2)*(accAcc))

    - or -

    =SUMPRODUCT(--(accProv=D2),--(accFYE=E2),(accAcc))

    I tried the below variations in VBA, and I keep getting run-time error 13. Any ideas?

    Please Login or Register  to view this content.
    The dynamic named ranges accProv, accFYE, and accAcc are on sheet Track Changes, and cells D2 and E2 are on sheet Production.

    TIA

    Jason
    Last edited by jasoncw; 02-05-2009 at 05:23 PM.

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

    Re: Using SumProduct Worksheet Function in VBA

    Sumproduct in VBA doesn't work quite the same way... normally better to use Evaluate, ie

    Please Login or Register  to view this content.
    (Evaluate can be called relative to a specific sheet or at Application level)

  3. #3
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208

    Re: Using SumProduct Worksheet Function in VBA

    Thanks, Donkey. I just found this out doing a Google search as well.

    Jason

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

    Re: Using SumProduct Worksheet Function in VBA

    Yeah I learnt the beauty of Evaluate in conjunction with Sumproduct when I was building my little Sumproduct Analyser add-in ...
    (with help from others I should add!)

+ 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