2 condition total

Peter100

Well-known Member
Joined
Apr 21, 2002
Messages
765
Hi

I wish to total a column of figures if they meet two criteria. ie.

in column A I have a value (1-12) in column B I have A monetary value and in column C it will contain a blank or an X

I want the total of column B if ithe value in A = 1 and the value in C = X
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
=SUMPRODUCT(--($A$2:$A$100=E2),--($C$2:$C$100=F2),$B$2:$B$100)

where E2 houses a value like 1 and F2 a value like X.

Alternatively, construct a pivot table from your data.
 
Upvote 0
Peter100 said:
Hi Aladin

That works a treat but what does the -- do :confused:

Conditionals like

$A$2:$A$100=E2

return an array of logical values like

{FALSE,TRUE,FALSE,...}

and since SumProduct or control+shift+entered formulas need numerical arrays, the -- bit coerces such arrays into arrays of 1's and 0's (1 and 0 are Excel's numerical equivalents of TRUE and FALSE) like

{0,1,0,...}

Another such coercers is: +0. Thus:

=SUMPRODUCT(($A$2:$A$100=E2)+0,($C$2:$C$100=F2)+0,$B$2:$B$100)

would also work.
 
Upvote 0

Forum statistics

Threads
1,216,165
Messages
6,129,250
Members
449,497
Latest member
The Wamp

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