# Counting the number of elements within an array that have data

ExcelMonkey
Guest
Posts: n/a

 17th May 2004
I have a 1D VBA array filled with integers. I have gone through th
array and deleted various element (i.e. array(3) = "",array(7) = "
etc).

I now want to count the number of elements within the revised arra
which contain integers only (or no data at all - whatever is easier).

How do I do this?

Thank

--
Message posted from http://www.ExcelForum.com

Greg Wilson
Guest
Posts: n/a

 17th May 2004
Try:

MsgBox Application.Count(Array)

Regards,
Greg

>-----Original Message-----
>I have a 1D VBA array filled with integers. I have gone

through the
>array and deleted various element (i.e. array(3)

= "",array(7) = ""
>etc).
>
>I now want to count the number of elements within the

revised array
>which contain integers only (or no data at all - whatever

is easier).
>
>How do I do this?
>
>Thanks
>
>
>---
>Message posted from http://www.ExcelForum.com/
>
>.
>

=?Utf-8?B?Y2hyaXM=?=
Guest
Posts: n/a

 17th May 2004
If you use the code i gave you to transfer the Elements to a New array all you have to do is use UBound(Myarray) to get the upper number and then based on your Option base: 0 = Num -1 OR 1 = Nu

But if you just want to count then here

Dim i as single, j as singl
For i = LBound(YourArray) To UBound(YourArray
if Not MyArray(i) = "" then j =j+
Next
Debug.print "Total number of elements with a value = " &
Debug.Print "Total number of elements with No Value = " UBound(YourArray) -

----- ExcelMonkey > wrote: ----

I have a 1D VBA array filled with integers. I have gone through th
array and deleted various element (i.e. array(3) = "",array(7) = "
etc)

I now want to count the number of elements within the revised arra
which contain integers only (or no data at all - whatever is easier)

How do I do this

Thank

--
Message posted from http://www.ExcelForum.com

Tom Ogilvy
Guest
Posts: n/a

 17th May 2004
Why not count them when you change them?

--
Regards,
Tom Ogilvy

"ExcelMonkey >" <<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a 1D VBA array filled with integers. I have gone through the
> array and deleted various element (i.e. array(3) = "",array(7) = ""
> etc).
>
> I now want to count the number of elements within the revised array
> which contain integers only (or no data at all - whatever is easier).
>
> How do I do this?
>
> Thanks
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>

sheila
Guest
Posts: n/a

 26th May 2004
i am wondering how i can get excel to count the recurring
part numbers in a list.

Guest
Posts: n/a

 26th May 2004
Have you tried using the COUNTIF function?

Roger
Shaftesbury (UK)

"sheila" <(E-Mail Removed)> wrote in message
news:1a2901c4433a\$5f6fc0a0\$(E-Mail Removed)...
> i am wondering how i can get excel to count the recurring
> part numbers in a list.

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Confused_in_Houston Microsoft Excel Misc 3 1st Oct 2008 11:05 PM =?Utf-8?B?VG9tTGVnYWRv?= Microsoft Excel Programming 13 16th Sep 2007 10:59 PM slingsh0t@hotmail.com Microsoft Excel Misc 2 7th Apr 2005 06:56 PM jake Microsoft C# .NET 2 13th Feb 2005 09:26 PM JimP Microsoft Excel Worksheet Functions 2 10th Mar 2004 08:29 PM

Features