View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Stuck with multi function Part 2

On May 11, 11:09 am, GS wrote:
Try a single line of COUNTIF using the OR function...
t = t + _
Application.WorksheetFunction.CountIf(Range(sz), _
OR("V","1/2V","i","1/2i"))


On May 11, 2:06*pm, GS wrote:
I didn't test this and so really don't know that it
would work. I suspect, though, that COUNTIF only
accepts 1 criteria


LOL! That is only a small part of your mistakes.

First, there is no OR function in VBA.

Second, you might have been thinking of the Excel paradigm
IF(OR({"V","½V","i","½i"}),...) in mind. But note that the array
constant (list of strings) is surrounded by curly braces, not
parentheses.

Third, if that was your intent, you would want to use Evaluate
expression, not WorksheetFunction. And you would need to change some
double-quotes to pairs of double-quotes, among other changes.

Fourth, not matter! Excel COUNTIF does not support the use of the OR
function in its criterion parameter. That is, the following paradigm
does __not__ work even in Excel, if this is what you had in mind:

=COUNTIF($B$6:$AF$17,OR({"V","½V","i","½i"}))

Excel will not report an error. It is simply does not do what you
might have intended.