SUMIF and IF

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?
 
S

Sheeloo

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
 
R

Rick Rothstein

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top