How can I add up how often certain text occurs?

M

Martin M

Hi everyone.

My problem is to add up how often certain text occurs in a column. Doing
this when the cells I want to use are sequential eg B2 - B12, is easy. I use
=COUNTIF(B2:B12,"E").
What I can't do is add up when the cells aren't sequential eg B2 - B5, B7,
B10 - B12.
I try =COUNTIF(B2:B5,B7,B10:B12,"E"), but excel tells me I've entered too
many arguements. Using colons and commas in this way works when I add
numbers, but not when I add occurences of text, and I don't know why!

Any help would be gratefully recieved.

Many thanks, Martin
 
M

Ms. P.

Is there a reason why you can use the cells sequentially? Unless the cells
you're omitting contain the result you're looking for, it shouldn't count
them right, or am I missing something?
 
D

Domenic

Try...

=SUMPRODUCT(--(ISNUMBER(MATCH(ROW(B2:B12),{2,3,4,5,7,10,11,12},0))),--(B2
:B12="E"))

OR

=SUMPRODUCT(COUNTIF(INDIRECT({"B2:B5","B7","B10:B12"}),"E"))

Hope this helps!
 
R

robmeister

Hello Martin

You already have the answer using =COUNTIF(A1:A12,"E") will add onl
E's even if you have other letters within the range.

Hope this help
 

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