# Re: Excel Count Functions

*From*: Mike H <MikeH@xxxxxxxxxxxxxxxxxxxxxxxxx>*Date*: Sun, 7 Dec 2008 07:16:00 -0800

Someone must be able to do better than this

call with

=CountChar(B2:E2,"a","b","c")

Function CountChar(rng As Range, ch1 As String, ch2 As String, ch3 As

String) As Long

For Each c In rng

If InStr(UCase(c.Value), UCase(ch1)) Then CountChar = CountChar + 1

If InStr(UCase(c.Value), UCase(ch2)) Then CountChar = CountChar + 1

If InStr(UCase(c.Value), UCase(ch3)) Then CountChar = CountChar + 1

Next

End Function

Mike

"Gary Mc" wrote:

My bad, you are absolutely correct. I apologize for the error!.

"David Biddulph" wrote:

Won't that double count if the cell contains both a and x?

--

David Biddulph

"Gary Mc" <GaryMc@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message

news:31731C01-C116-45B2-9976-98CD8C091542@xxxxxxxxxxxxxxxx

I'm sure there are other and probably better solutions but this will work

=SUM(COUNTIF(B2:E2,"*a*"),COUNTIF(B2:E2,"*x*"))

Hope this is helpful

GMc

"Gasbag" wrote:

I am trying to count the number of cells in a row that contain one or

more of

three letters?

**Follow-Ups**:**Re: Excel Count Functions***From:*Rick Rothstein

**References**:**Excel Count Functions***From:*Gasbag

**RE: Excel Count Functions***From:*Gary Mc

**Re: Excel Count Functions***From:*David Biddulph

**Re: Excel Count Functions***From:*Gary Mc

- Prev by Date:
**Re: Excel Count Functions** - Next by Date:
**Re: Excel Count Functions** - Previous by thread:
**Re: Excel Count Functions** - Next by thread:
**Re: Excel Count Functions** - Index(es):