I'm speeding up VBA based calculations in large worksheets. Using VBA Arrays in stead of ranges is great. Some stuff doesn't seem to work however...
Where: Application.Count(Array) works fine, it appears that Application.CountIf(Array,Condition) fails as it seems that the Array must be a Range for CountIf...
Is this true or am I missing something here??
Countif on arrays
-
- BronzeLounger
- Posts: 1258
- Joined: 03 Feb 2010, 19:59
- Location: Terneuzen, the Netherlands
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Countif on arrays
That is correct. The same is true in worksheet formulas:
=COUNT({1,2,3,2,1}) works, it correctly returns 5.
=COUNTIF({1,2,3,2,1},2) can't even be entered as a formula.
The first argument of COUNTIF must be a range. Similar for COUNTIFS, SUM, SUMIFS, AVERAGEIF and AVERAGEIFS.
=COUNT({1,2,3,2,1}) works, it correctly returns 5.
=COUNTIF({1,2,3,2,1},2) can't even be entered as a formula.
The first argument of COUNTIF must be a range. Similar for COUNTIFS, SUM, SUMIFS, AVERAGEIF and AVERAGEIFS.
Best wishes,
Hans
Hans