View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Farhad Farhad is offline
external usenet poster
 
Posts: 281
Default sum only positive numbers for certain groups

Hi,

First sort your data based on column A then enter this formula in C2 and
then copy drag down to where ever you need:

=IF(A2=A1,"",SUMPRODUCT(--($A$2:$A$100=A1),--($B$2:$B$1000),$B$2:$B$100))

you can extend the range to what ever you want.

Thanks,
--
Farhad Hodjat


"SteveC" wrote:

Col A Col B Col C
apples -1
apples 3
apples 1 4
oranges -1
oranges -5
bananas 1 1

What formula in C will sum only positive numbers for each group of lables,
as indicated above, leaving other cells blank?

haven't figured out how to adjust sumproduct yet... thanks...