SumProduct with two criterias

RZoig

New Member
Joined
Jul 10, 2013
Messages
48
Office Version
  1. 365
Platform
  1. Windows
Hello,

Marcelo helped me with a sumproduct formula that would only return results that matched a certain criteria.

this is the formula "=SUMPRODUCT(($C$2:$C$6)*($A$2:$A$6=$G2);($D$2:$D$6)*($A$2:$A$6=$G2))"
criteria is on G2 (b), criteria array on A2:A6. Result is 4,9.

But I want a 2nd criteria and the results should only SUMPRODUCT 2nd criteria nested within 1st criteria.
It must be a single formula, however complicated.

This is the array, placed in A1:

1st2ndValTax
aP20,21st criteriab4,9
bx30,12nd criteriap5
bp30,7
bp50,52nd in 1stexpected ->4,6
co50,6

<tbody>
</tbody>

In other words, I want SUMPRODUCT Val and Tax with 2nd criteria = 'p' ONLY WHEN 1st criteria ='b'
Result must be 4,6

Thank you.
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try:

=SUMPRODUCT(($A$2:$A$6=$G$2)*($B$2:$B$6=$G$3)*$C$2:$C$6*$D$2:$D$6)
 
Upvote 0
Thank you guys!

Both worked. I was trying to use AND but it seems I was complicating things.

But I gotta ask, Marcelo: Whata heck is that?? --(A2:A6=G2)? --?? What that stands for???
 
Upvote 0
SUMPRODUCT requires arrays of numbers
The comparison (A2:A6=G2) returns an array of logical values False or True like
{False;True;True;True;False}
-- converts False and True to, respectively, 0 and 1
{0;1;1;1;0}

M.
 
Last edited:
Upvote 0
Simple things with great results

That's what I like the best.

Thanks again!
( Valeu Marcelo! ;) )
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top