View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bdddd
 
Posts: n/a
Default How to use a range in SUMIF?

Thank you for your help

"Max" wrote:

"bdddd" wrote
This works, but I'm not sure I understand why.


Try Bob Phillips' excellent coverage on SUMPRODUCT at his:
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

Scroll down to "SUMPRODUCT Explained" where you'll find all the details
fully explained. Take the time to look through the entire white paper, you
will be well on your way to mastering it very quickly ..

A short take on it ..

=SUMPRODUCT((B3:B350=K6)*

(B3:B350<=TODAY()),L3:L350)

The 2 condition tests:
B3:B350=K6
B3:B350<=TODAY()

will evaluate into 2 arrays of TRUEs / FALSEs:
{TRUE,FALSE,TRUE, ...}
{FALSE,FALSE,TRUE, ...}

depending on whether:
B3 =K6, B4 =K6, ...
B3 <=TODAY(), B4 <=TODAY(), ...

Multiplying the 2 TRUE / FALSE arrays together would then evaluate to a
single numeric array of 1's and 0's:
{0,0,1, ...}

Corresponding items from array 1 are multiplied with those from array 2,
viz. for the sample above:

TRUE x FALSE = 0
FALSE x FALSE = 0
TRUE x TRUE = 1

and then .. SUMPRODUCT({0,0,1, ...},L3:L350)
would evaluate each as:
(0 x L3) + (0 x L4) + (1 x L5) + ...
giving the final required sum from within the range L3:L350

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---