+ Reply to Thread
Results 1 to 10 of 10

SUMPRODUCT in vba

  1. #1
    Registered User
    Join Date
    08-11-2021
    Location
    Singapore
    MS-Off Ver
    2007
    Posts
    24

    SUMPRODUCT in vba

    Hi,

    I have the following sumproduct formula

    =SUMPRODUCT(($A$2:$A$16 = 3) *( $B$2:$B$16 = "ddd" )*( $C$2:$C$16 = 3 )*( $E$1:$K$1 = "Mar" ) * ( $E$2:$K$16 ))

    How can i pull the criteria (3, ddd, 3, Mar) from textboxes and use a evaluate function to calculate it?

  2. #2
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: SUMPRODUCT in vba

    This should work assuming...

    TextBox1 contains 3 (the first one)
    TextBox2 contains ddd
    TextBox3 contains 3 (the second one
    TextBox4 contains Mar

    Please Login or Register  to view this content.
    Last edited by Rick Rothstein; 08-23-2021 at 03:45 AM.

  3. #3
    Registered User
    Join Date
    08-11-2021
    Location
    Singapore
    MS-Off Ver
    2007
    Posts
    24

    Re: SUMPRODUCT in vba

    That works. Thank you!

    Is it possible to get the cell addresses instead of the value?

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: SUMPRODUCT in vba

    Quote Originally Posted by thoufik11 View Post
    Is it possible to get the cell addresses instead of the value?
    What do you mean by cell addresses... the cell addresses of what?

  5. #5
    Registered User
    Join Date
    08-11-2021
    Location
    Singapore
    MS-Off Ver
    2007
    Posts
    24

    Re: SUMPRODUCT in vba

    cell address of the result.

    for example;

    Attachment 745150

    if I choose 3 ddd 3 Mar, how can i get the result as G2?

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: SUMPRODUCT in vba

    Your attachment is invalid. You must follow the steps outlined in the yellow box at the top of this window to attach a file for us to see it.

  7. #7
    Registered User
    Join Date
    08-11-2021
    Location
    Singapore
    MS-Off Ver
    2007
    Posts
    24

    Re: SUMPRODUCT in vba

    cell address of the result.

    for example;



    if I choose 3 ddd 3 Mar, how can i get the result as G2?
    Attached Images Attached Images

  8. #8
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: SUMPRODUCT in vba

    I'm about to go to sleep for the night but I have to say I am completely confused now. Your original question dealt with four TextBoxes and ran a sum down a mathematical calculation for multiple rows for four different columns and a fixed cell... now your have four cells instead of TextBoxes and only one row of data where you are wanting to find the value. I do not see how to apply the formula you were evaluating originally (multiple row summation) to your single row. You are going to have to provide a lot more detail as to what you are looking for if you expect to get a solution that you can use.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: SUMPRODUCT in vba

    This seems to do the job.

    Please Login or Register  to view this content.
    Be aware that there's no error check for the moment so when there's no match for 1 of the entered values in the Textboxes you will get an error.
    Attached Files Attached Files
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  10. #10
    Registered User
    Join Date
    08-11-2021
    Location
    Singapore
    MS-Off Ver
    2007
    Posts
    24

    Re: SUMPRODUCT in vba

    Hi, That works.

    Thank you so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Sumproduct with multiple variants - Help! I'm a newbie to sumproduct
    By KIGeorge in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-16-2019, 01:21 AM
  2. Combine sumif/sumproduct or sumproduct with multiple criteria
    By sab128 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2018, 08:25 AM
  3. [SOLVED] Use sumproduct to further parse a sumproduct calculation
    By Araise in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-19-2015, 08:17 PM
  4. Count SUMPRODUCT Members / Average of SUMPRODUCT
    By Shingaru in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2014, 03:59 PM
  5. Replies: 1
    Last Post: 05-19-2012, 02:54 AM
  6. Replies: 5
    Last Post: 04-20-2012, 08:54 AM
  7. Using a SumProduct Count to find a SumProduct Total?
    By XL021710 in forum Excel General
    Replies: 3
    Last Post: 02-18-2010, 08:31 AM

Tags for this Thread

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