+ Reply to Thread
Results 1 to 10 of 10

SumProduct IF

  1. #1
    Registered User
    Join Date
    09-23-2003
    Posts
    18

    SumProduct IF

    Does anyone know of a good way to multiply of doing a SumProduct if? Something like multiply then sum all values in column A and B only when column C equals a certain flag. The values to multiply and then sum would not be in order?

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SumProduct IF

    You mean something like:

    =Sumproduct(--(C1:C100="flag"),A1:A100,B1:B100)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    09-23-2003
    Posts
    18

    Re: SumProduct IF

    Perfect!! Thanks.

  4. #4
    Registered User
    Join Date
    11-08-2011
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: SumProduct IF

    I know this is an old thread, but can someone tell me what the --( part of the =Sumproduct(--(C1:C100="flag"),A1:A100,B1:B100) formula means?

    Thank you!

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SumProduct IF

    It coerces the TRUE/FALSE results for each conditional argument to 1/0 results, so Sumproduct can do the math.

  6. #6
    Registered User
    Join Date
    11-30-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: SumProduct IF

    Is there a way to multiply the two columns using two flags? In other words, multiply values Columns A and B only when Column C = Flag1 and Column D = Flag2

  7. #7
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: SumProduct IF

    =SUMPRODUCT(--(C1:C100="flag1")*(D1:D100="Flag2"),A1:A100,B1:B100)
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  8. #8
    Registered User
    Join Date
    03-03-2013
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: SumProduct IF

    Sorry to unbury this thread, but my doubt is concerning this command "sumproduct".
    I'm using =sumproduct(--(A1:J1=A2:J2)) to count same values at the same column between the two lines, works great.
    But I don't want to count empty cells. As example, when there is an empty cell in A3 and in B3, it counts as same.
    Is there a way to input some (if <> "") in there?

    Example:
    A__DEFGHIJ
    AB__CDGHIJ
    (suppose _ is a empty cell). In those lines, i'm counting A, _, G, H, I, J. And I don't want to count the empty one.
    Thanks in advance.
    edit:
    nevermind!!!
    Just made it!, used the double flag stuff: =sumproduct(--(A1:J1=A2:J2)*(A1:J1<>""))
    Last edited by Aderbalito; 03-03-2013 at 07:45 PM.

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: SumProduct IF

    Aderbalito,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  10. #10
    Registered User
    Join Date
    04-17-2015
    Location
    Hanoi, Vietnam
    MS-Off Ver
    Microsoft Office 2013
    Posts
    10

    Re: SumProduct IF

    Excel's Sumif and Sumproduct with multiple criteria
    https://www.youtube.com/watch?v=6l5wpZrVvT0

    Combining Sumproduct and VLookup function in Excel
    https://www.youtube.com/watch?v=lkT9OAgcBuw
    Last edited by huyle2103; 08-24-2015 at 08:40 PM.
    Tips Excel: http://goo.gl/EXAjwP

+ 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