+ Reply to Thread
Results 1 to 2 of 2

Sumproduct in vba?

Hybrid View

  1. #1
    Registered User
    Join Date
    05-29-2010
    Location
    Greece
    MS-Off Ver
    Excel 2007
    Posts
    27

    Sumproduct in vba?

    Hello, I have difficulties in writing this sumpr. formula in vba:
    sumproduct(--(A2:A200="A");--(B2:B200)) it ried this but to no avail..combobox1 are the values in A and sumvalue is column B. The formula is supposed to account for changes in the criteria in column A. Thank you very much in advance!
    Range("AC1").Formula = "=sumproduct(--(Me.ComboBox1 & """" ),--(sumvalue)"

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Sumproduct in vba?

    Hi,
    It is hard to see how you have this setup to give a better answer, but

    If you want the formula in cell AC1 try:
    Range("AC1").Formula = "Sumproduct(--(A2:A200=""A""),--(B2:B200)) "
    If you want VBA to calculate it outside the cell from values in a Userform ComboBox you might try
    WorksheetFunction.Sumproduct( Formula goes in here )

    hth
    Last edited by davesexcel; 11-29-2010 at 08:46 PM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

+ 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