+ Reply to Thread
Results 1 to 11 of 11

sumproduct - three variables

  1. #1
    Registered User
    Join Date
    01-30-2006
    Posts
    39

    sumproduct - three variables

    I am trying to add an additional criteria to the following sumproduct formula. The formula below works fine to add up values that are within a date range. However, I want to add values within a specified date range as well as one additional variable. Any suggestions? The additional variable is in column G.

    Thanks for any help.

    SUMPRODUCT(--($A$3:$A$1015>=$A1026),--($A$3:$A$1015<=$B1026),D$3:D$1015)

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    You mean column G has to be a specific value? try something like this where that value is "x"

    =SUMPRODUCT(--($A$3:$A$1015>=$A1026),--($A$3:$A$1015<=$B1026),--($G$3:$G$1015="x"),D$3:D$1015)

    if the value is numeric don't use quotes

  3. #3
    Registered User
    Join Date
    01-30-2006
    Posts
    39
    Thanks.

    I tried it, but i must be doing something wrong. Here's what I did:

    SUMPRODUCT(--($A$3:$A$1015>=$A1027),--($A$3:$A$1015<=$B1027),--($A$3:$A$1015="a"),D$3:D$1015)

    Can you see if I did something incorrectly?

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    You seem to be mixing data types in column A. You indicate that column A contains dates, but then you want to look for a text value ("a").

    Is this what you are really trying to do?

    rylo

  5. #5
    Registered User
    Join Date
    01-30-2006
    Posts
    39
    Yes, that is what I am trying to do.

  6. #6
    Registered User
    Join Date
    06-11-2007
    Location
    Nonthaburee Province, Thailand
    MS-Off Ver
    MS Office 2003 to MS Office 2010
    Posts
    82
    When I'm use SUMPRODUCT, I will not Use "-" sign Because "-" mean NOT, "--" MEAN "Equal"

    Sometime the "-" will interfere calculation (Still now I have question in my mine and can not find out why the "-" interfeere calucation.) So I will use the (*)

    Please Login or Register  to view this content.
    N. Yauvasuta
    Power User Excel.

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Aren't you looking for an "a" in column G, that was the column you mentioned in your first post.

    That last formula will always give zero because the value in column A can't possibly satisfy all of the conditions, i.e. it can't be a date in your range and = "a"

    Are you specifiying an incorrect column or do you want the column D values to be summed if column A has a date in the range or an "a"? If it's the latter try

    =SUMPRODUCT(($A$3:$A$1015>=$A1026)*($A$3:$A$1015<=$B1026)+($A$3:$A$1015="a"),D$3:D$1015)

  8. #8
    Registered User
    Join Date
    01-30-2006
    Posts
    39
    That still doesn't work. Can you not use three variables with sumproduct?

  9. #9
    Registered User
    Join Date
    01-30-2006
    Posts
    39
    Actually THAT did work.

    Thanks so much!!!

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Quote Originally Posted by nattasiray
    When I'm use SUMPRODUCT, I will not Use "-" sign Because "-" mean NOT, "--" MEAN "Equal"

    Sometime the "-" will interfere calculation (Still now I have question in my mine and can not find out why the "-" interfeere calucation.) So I will use the (*)

    Please Login or Register  to view this content.
    Hello nattasiray,

    I'm not proposing using - anywhere, just --

    -- acts as a "co-ercer" to convert TRUE/FALSE arrays to 1/0. Your proposed amendment, just alters the way the result is calculated by implicitly co-ercing the arrays (by multiplying them together).

    There aren't any circumstances in which that amendment would change the result, unless D3:D1015 contains text, in which case your proposed formula will return an error.....

  11. #11
    Registered User
    Join Date
    06-11-2007
    Location
    Nonthaburee Province, Thailand
    MS-Off Ver
    MS Office 2003 to MS Office 2010
    Posts
    82
    Quote Originally Posted by daddylonglegs
    Hello nattasiray,

    I'm not proposing using - anywhere, just --

    -- acts as a "co-ercer" to convert TRUE/FALSE arrays to 1/0. Your proposed amendment, just alters the way the result is calculated by implicitly co-ercing the arrays (by multiplying them together).

    There aren't any circumstances in which that amendment would change the result, unless D3:D1015 contains text, in which case your proposed formula will return an error.....
    Thanks for daddylonglegs

    Dear rylo

    I recommend you that the next time when you post the question please attach the sample file contains data and the result. It will help all helpdesk in this forum to given the correct solution in the fast minute.

    Best reguard

+ 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