Count of values in a column based on values in another column

S

student

How do i count values based on values in another column.

For example

Col1 Col2
A 10
A
A 20
B 12
B 15
B

I want a formula for counting values in col2 where Col1 is "A". So the
answer i am looking for is 2

Thanks
 
S

student

Thanks Julie for reply, but it did not give me the correct answer. In fact
it gives me answer as 0

thanks
 
J

JulieD

Hi

could you copy & paste your exact formula in here.
What is in cell B2 - a space or a formula or???

Regards
JulieD
 
S

student

Hi Julie,
Thanks Julie. It worked perfectly.

just one more question. If instead of count what if i want to sum it ?

Thanks
 
J

JulieD

Hi

glad it worked (had me worried there for awhile) ... in the example that
you've given you can use

=SUMIF(A1:A6,"A",B1:B6)
to sum the A's ... subsitute B for A to sum the B values or

if cell C1 had A in it then in D1 you could type
=SUMIF(A1:A6,C1,B1:B6)

Regards
JulieD
 
S

student

Thanks very Much Julie. Just one more question out of curiousity.

when i checked in MS help for SUMPRODUCT, it says the two parameters should
be of same types whereas here, one is a string and another is number.In short can you please explain whats happening here. Also when i just say
A2*B2 it gives me #value! which is obvious since i am multiplying string and
number.

Thanks. You are simply great
 
R

RagDyeR

Check out this link:

http://www.xldynamic.com/source/xld.SUMPRODUCT.html

--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================

Thanks very Much Julie. Just one more question out of curiousity.

when i checked in MS help for SUMPRODUCT, it says the two parameters should
be of same types whereas here, one is a string and another is number.In short can you please explain whats happening here. Also when i just say
A2*B2 it gives me #value! which is obvious since i am multiplying string and
number.

Thanks. You are simply great
 
J

JulieD

Hi Student

thanks for the feedback - sorry haven't been around for a couple of days ...
haven't had email working therefore couldn't do anything.

i hope you had time to check out that link that RagDyeR gave you as it
explains the sumproduct function really well.

let us know if you have any more questions.

Regards
JulieD
 

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