Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Count quanity of values in an Array

Hi,

Dim myArray(54,100) as Sting

Can I count the number of items in the second dimension of my array...?
without looping through all 100 possible values and checking to see if they
are not nulll...

thanks

Simon Shaw

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Count quanity of values in an Array

What do you mean by the second dimension of the array. Each row has 100
columns. Each column has 54 rows. What are you trying to check?

--
Regards,
Tom Ogilvy

"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
Hi,

Dim myArray(54,100) as Sting

Can I count the number of items in the second dimension of my array...?
without looping through all 100 possible values and checking to see if

they
are not nulll...

thanks

Simon Shaw



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Count quanity of values in an Array

I am storing user selection lists from a ListBox in the Array:
myArray(Filter_Number, Selected_Items)
where the max filters are 54 and the max selected items is 100.
Usually the user will select less than 100 items say 10 items for say filter
1, how can I count the 10 items of the selected_items without looping through
the array to see if items have been stored?

I want to avoid:

for i = 1 to 100
if myArray(1, i).value < "" then _
count = count + 1
next i

"Tom Ogilvy" wrote:

What do you mean by the second dimension of the array. Each row has 100
columns. Each column has 54 rows. What are you trying to check?

--
Regards,
Tom Ogilvy

"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
Hi,

Dim myArray(54,100) as Sting

Can I count the number of items in the second dimension of my array...?
without looping through all 100 possible values and checking to see if

they
are not nulll...

thanks

Simon Shaw




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Count quanity of values in an Array

This counts the number of values a row at a time.

Sub ABC()
Dim v(1 To 54, 1 To 100)
Dim v1 as Variant
For i = 1 To 10
For j = 1 To 10
v(Int(Rnd() * 54 + 1), Int(Rnd() * 100 + 1)) = i * j
Next
Next
For i = 1 To 54
v1 = Application.Index(v, i, 0)
Debug.Print i, Application.Count(v1)
Next
End Sub

If the array elements would be alphanumeric, use countA

--
Regards,
Tom Ogilvy


"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
I am storing user selection lists from a ListBox in the Array:
myArray(Filter_Number, Selected_Items)
where the max filters are 54 and the max selected items is 100.
Usually the user will select less than 100 items say 10 items for say

filter
1, how can I count the 10 items of the selected_items without looping

through
the array to see if items have been stored?

I want to avoid:

for i = 1 to 100
if myArray(1, i).value < "" then _
count = count + 1
next i

"Tom Ogilvy" wrote:

What do you mean by the second dimension of the array. Each row has 100
columns. Each column has 54 rows. What are you trying to check?

--
Regards,
Tom Ogilvy

"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
Hi,

Dim myArray(54,100) as Sting

Can I count the number of items in the second dimension of my

array...?
without looping through all 100 possible values and checking to see if

they
are not nulll...

thanks

Simon Shaw






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
Count values in array of data where no blanks in one column CW Excel Worksheet Functions 4 April 21st 10 12:43 PM
How to Reference an Array to Count Values? Mashuganah Excel Discussion (Misc queries) 6 December 4th 09 04:33 PM
Count occurances of equal values in two col. - array within SUMPRO John_J Excel Worksheet Functions 5 September 30th 08 02:19 PM
Can an Array formula count unique values and report no. of times for each? Father Guido[_6_] Excel Programming 3 May 21st 05 06:58 AM
Count how many different text values in an array. OVERLOAD Excel Worksheet Functions 3 April 14th 05 04:12 PM


All times are GMT +1. The time now is 07:01 AM.

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

About Us

"It's about Microsoft Excel"