View Single Post
  #1   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?

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