SUMIF and IF

  • Thread starter Thread starter silversilver
  • Start date Start date
S

silversilver

I have two columns, one of text and one of numbers.

I'm trying to get a sum of the cells in column A if column B has a
particular text.

For Instance:

1 AAA
2 BBB
1 CCC
3 AAA

I need a formula that counts the value of the cells in column A when column
B says AAA.

Any suggestions?
 
Enter this in D1 with AAA or BBB in C1
=SUMPRODUCT(--(A1:A100),--(B1:B100=C1))
to get the sum
and
=SUMPRODUCT(--(B1:B100=C1))
to get the count

Change 100 to the end of your data set

to get count
 
The SUMIF function will give you that...

=SUMIF(B:B,"AAA",A:A)

although, if possible, I would restrict the ranges to the smallest size that
will accommodate your data, if at all possible; for example...

=SUMIF(B1:B100,"AAA",A1:A100)

assuming your data will always fit within that specified range.
 
Back
Top