# Microsoft Office Application Help - Excel Help forum > Excel Formulas & Functions >  >  SumProduct IF

## jpx

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?

----------


## NBVC

You mean something like:

=Sumproduct(--(C1:C100="flag"),A1:A100,B1:B100)

----------


## jpx

Perfect!!  Thanks.

----------


## Katman

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!

----------


## NBVC

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

----------


## LoveExcels

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

----------


## Palmetto

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

----------


## Aderbalito

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<>""))

----------


## arlu1201

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.

----------


## huyle2103

*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

----------

