View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default sum if with multiple criteria

If you have Excel 2007 you could use the new SUMIFS() function. If you're
using an older version, as most of us [probably] are, then the SUMPRODUCT()
function is what you need:

=SUMPRODUCT(--(A2:A5="red"),--(B2:B5="apples"),C2:C5)

That assumes the first entry is in row 2 and that row 1 probably contains
column labels.

You could even set it up to give you product totals in another area, by
entering the different product descriptions in 2 columns and putting the
formula next to them, as
Col G Col H Col I
red apples =SUMPRODUCT(--(A$2:A$5=G2),--(B$2:B$5=H2),C$2:C$5)
green apples =SUMPRODUCT(--(A$2:A$5=G3),--(B$2:B$5=H3),C$2:C$5)
baby carrots =SUMPRODUCT(--(A$2:A$5=G4),--(B$2:B$5=H4),C$2:C$5)

Note that after you enter the formula in I2, it fills down very nicely.

"djk" wrote:

how can I use multiple criteria and the sum if function.

how could I sum for "red apples"?

ColA ColB ColC
red apples 5
green apples 2
baby carrots 1
red apples 3

Thanks

--
djk