View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default excel: count uppercase letters in a cell

"Leo Heuser" wrote...
Contrary to the other suggestions, here's one that works for
all characters not only the characters of the English alphabet <bg

=SUMPRODUCT((CODE(MID(A1,ROW(INDIRECT("1:"&LEN(A1 ))),1))=
CODE(UPPER((MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1) ))))+0)


You might want to consider testing before you post. And maybe reading OPs
CAREFULLY. Where, Oh Great Internationalizer, did the OP mention that the
cells s/he would be checking would include ONLY letters? Or do you have such
feable grasp of how UPPER works that you're ignorant of the fact that it
returns the same character for NON-LETTERS?

If cell A1 contained

Leo Heuser makes FOOLISH, CONDESCENDING responses.

the correct number of upper case letters is 22, but your Oh So Wonderful AND
Inclusive! formula returns 29. Why? because it also includes the spaces,
comma and period in the count.

Correct results are even more important to handling other languages in the
sense that you might as well make it correct FOR AT LEAST ONE LANGUAGE. At
least all the other responses managed a correct count for English (and,
FWIW, Hawaiian and perhaps all Polynesian languages).

The brute force approach I showed is at least easily adapted to include any
letters one would care to check. Why, even you should be able to figure out
how to adapt it without screwing up.