I want to count the occurrence of certain letters in a range of cells. In my attachment I need the sum of how many times the letters "C,M,Y,K" occur in the range A2:D2.
I want to count the occurrence of certain letters in a range of cells. In my attachment I need the sum of how many times the letters "C,M,Y,K" occur in the range A2:D2.
Last edited by GreenMartian; 03-15-2009 at 12:57 PM.
How about a simple:
=COUNTIF(A2:D2,"*Y*")+COUNTIF(A2:D2,"*C*")+COUNTIF(A2:D2,"*M*")+COUNTIF(A2:D2,"*K*")
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
The below:
=SUM(COUNTIF(A2:D2,{"*C*","*M*","*K*","*Y*"}))
Is the same as JB's only using an inline array constant & SUM - ie saves you have to write out the COUNTIF multiple times.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks