Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default Using Countif on Array

Can't seem to get this to work. Run-time Error 438 - Object does not support
property or method. Why is this? RowNumberArray has numbers in it.

NumOccurences = Application.WorkshseetFunction.CountIf(RowNumberAr ray,
RowNumberArray(X))

?RowNumberArray(X)
7
?UBOUND(RowNumberArray)
5793
?LBOUND(RowNumberArray)
0

Thanks
EM
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Using Countif on Array

Why don't you just loop. Probably more efficient than calling a worksheet
function

count = 0
for i = 0 to (UBOUND(RowNumberArray) - 1)
if RowNumberArray(X) = RowNumberArray(i) then
count = count + 1
end if
next i

"ExcelMonkey" wrote:

Can't seem to get this to work. Run-time Error 438 - Object does not support
property or method. Why is this? RowNumberArray has numbers in it.

NumOccurences = Application.WorkshseetFunction.CountIf(RowNumberAr ray,
RowNumberArray(X))

?RowNumberArray(X)
7
?UBOUND(RowNumberArray)
5793
?LBOUND(RowNumberArray)
0

Thanks
EM

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Using Countif on Array

ExcelMonkey wrote:
Can't seem to get this to work. Run-time Error 438 - Object does not support
property or method. Why is this? RowNumberArray has numbers in it.

NumOccurences = Application.WorkshseetFunction.CountIf(RowNumberAr ray,
RowNumberArray(X))


The worksheet function COUNTIF doesn't accept arrays. If you don't want
to loop as suggested, if the functions in the freely downloadable file
at http://home.pacbell.net/beban are available to your workbook

NumOccurrences = ArrayCountIf(RowNumberArray, RowNumberArray(X))

Alan Beban
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Countif array LearningHorse Excel Worksheet Functions 0 January 13th 11 09:06 PM
COUNTIF Array Pyrite Excel Discussion (Misc queries) 7 August 27th 08 04:21 PM
Countif Array Mike Excel Worksheet Functions 3 December 5th 07 09:06 PM
countif within array Grant Excel Worksheet Functions 3 October 26th 06 07:58 AM
How do I use countif an array for =45<=50 البيانات[_2_] Excel Programming 9 February 4th 06 08:23 PM


All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"