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

  • Thread starter Thread starter student
  • Start date Start date
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
 
Thanks Julie for reply, but it did not give me the correct answer. In fact
it gives me answer as 0

thanks
 
Hi

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

Regards
JulieD
 
Hi Julie,
Thanks Julie. It worked perfectly.

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

Thanks
 
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
 
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
 
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
 
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
 
Back
Top