View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default How do I compute a sum based on two columns

One way:

=SUMPRODUCT(--(A1:A1000="X"),--(B1:B1000="Y"))

will count. If you want to sum a third column:

=SUMPRODUCT(--(A1:A1000="X"),--(B1:B1000="Y"),C1:C1000)

For an explanation of "--" see

http://www.mcgimpsey.com/excel/doubleneg.htm





In article ,
"FISHbGood2" wrote:

I want to compute a sum based on whether or not two columns contain certain
values. In otherwords, count the number of rows with colA = "X" and colB =
"Y".