View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
John[_19_] John[_19_] is offline
external usenet poster
 
Posts: 87
Default why doesn't this countif work?

That's more or less what I'm doing. It's just a mystery why countif
won't work. It works with a single "?".

Barb Reinhardt wrote:
In the help, it looks like it should work, but I couldn't get it to work just
in a worksheet. I did get this to work in the worksheet when entered as an
array function.

=COUNT(IF(LEN(D6:D13)=3,D6:D13))

You may want to try something like that.

HTH,
Barb Reinhardt

"John" wrote:

NumberOfTriples = WorksheetFunction.CountIf(Myrange, "???")
The above gives NumberOfTriples as 1 which is incorrect


For Each cell In MyRange
If Len(cell) = 3 Then NumberOfTriples = NumberOfTriples + 1
Next
This one gives NumberOfTriples as 4 which is correct


The ranges are simple 3x3 or 5x5 like A1:C3

thanks

John