View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default why doesn't this countif work?

If WorksheetFunction.CountIf(WholeThing, "?")=81 then the
sudoku is solved. And that works just fine.


Why not just use the CountA worksheet function? Assuming WholeThing is a Range...

If WorksheetFunction.CountA(WholeThing) = 81 Then

--
Rick (MVP - Excel)


"John" wrote in message ...
Its numbers as text. Working on sudoku solver so numbers stored as text,
at least I hope so. The cells are all formated as text and every
variable holding the data is a string variable. All string manipulations
seem to work fine such as mid, len, trim etc. when working with the cell
as a range. The Find function works with "???" but not the countif
function. However the countif works with "?". I have one range,
WholeThing, which is the entire sudoku.

If WorksheetFunction.CountIf(WholeThing, "?")=81 then the sudoku is
solved. And that works just fine.

It's not such a big deal cause there's other ways but it's just a mystery.


John


barry houdini wrote:
John,

What sort of data do you have in the range? COUNTIF(range,"???") will
only count text not numbers, if you want to count cells with 3
characters with a formula

=SUMPRODUCT(--(LEN(range)=3))