Help Counting Alpha Characters

N

neon

I have an array B2:H28. These cells can contain any combination of
characters A,B,C,D,E,F,G,H.
I want to count the number of As and Bs etc.
I am using =COUNTIF(B2:H28,"A") and =COUNTIF(B2:H28,"B") ... which
only works if the cell contains single alpha characters. Once there is
a combination it falls apart.
Any help appreciated
 
B

Bernard Liengme

Try COUNTIF(B2:H28,"A*")
Works for me but if cell has ABCA, only one A is counted.
 
B

Bob Phillips

Neon,

I think this will do it for you

=SUMPRODUCT(LEN(B2:H28))-SUMPRODUCT(LEN(SUBSTITUTE(B2:H28,"A","")))

Counts the As

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
P

Peo Sjoblom

That can be shortened a bit


=SUMPRODUCT(LEN(B2:H28)-LEN(SUBSTITUTE(B2:H28,"A","")))

or

=SUM(LEN(B2:H28)-LEN(SUBSTITUTE(B2:H28,"A","")))

array entered
 

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