anilsolipuram wrote...
Try this
=3DSUMPRODUCT(--(A1:A6<0),B1:B6,A1:A6)/(SUMPRODUCT(--(A1:A6<0)))
WRONG! Try reading the OP's follow-up. Column *B* contains the weights.
"A zero-weighted average would just be the following formula
sumproduct(A1:A6,B1:B6)/sum(B1=AD:B6)"
There's no need for a conditional expression in the numerator, only the
denominator.
=3DSUMPRODUCT(A1:A6,B1:B6)/SUMIF(A1:A6,"<0",B1:B6)
since the 0s in col A will effectively exclude the corresponding col B
values from the SUMPRODUCT result.
|