Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting items in an array
How do i count the number of items in array lets say i have declaration as below DiscreteData = Array("MPN", "Vendor") How do i count the items? thankx in adavanc -- ajitpalsingh20 ----------------------------------------------------------------------- ajitpalsingh200's Profile: http://www.excelforum.com/member.php...fo&userid=1615 View this thread: http://www.excelforum.com/showthread.php?threadid=32051 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting items in an array
ajitpalsingh200,
Dim ArrayItemCount as Long ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) NickHK "ajitpalsingh200" wrote in message ... How do i count the number of items in array lets say i have declaration as below DiscreteData = Array("MPN", "Vendor") How do i count the items? thankx in adavance -- ajitpalsingh200 ------------------------------------------------------------------------ ajitpalsingh200's Profile: http://www.excelforum.com/member.php...o&userid=16150 View this thread: http://www.excelforum.com/showthread...hreadid=320512 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting items in an array
NickHK wrote:
ajitpalsingh200, Dim ArrayItemCount as Long ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) NickHK The above works for a 1-based array; to allow for a 0-based or 1-based array, substitute ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) + 1 Alan Beban "ajitpalsingh200" wrote in message ... How do i count the number of items in array lets say i have declaration as below DiscreteData = Array("MPN", "Vendor") How do i count the items? thankx in adavance -- ajitpalsingh200 ------------------------------------------------------------------------ ajitpalsingh200's Profile: http://www.excelforum.com/member.php...o&userid=16150 View this thread: http://www.excelforum.com/showthread...hreadid=320512 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting items in an array
There is no built-in support for finding the dimensions of an array in VBA/VB
without prior knowledge of its rank (number of dimensions). The nearest solution is to do it by trial and error. "Alan Beban" wrote: NickHK wrote: ajitpalsingh200, Dim ArrayItemCount as Long ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) NickHK The above works for a 1-based array; to allow for a 0-based or 1-based array, substitute ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) + 1 Alan Beban "ajitpalsingh200" wrote in message ... How do i count the number of items in array lets say i have declaration as below DiscreteData = Array("MPN", "Vendor") How do i count the items? thankx in adavance -- ajitpalsingh200 ------------------------------------------------------------------------ ajitpalsingh200's Profile: http://www.excelforum.com/member.php...o&userid=16150 View this thread: http://www.excelforum.com/showthread...hreadid=320512 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting items in an array
I have an example of how to determine number of dimensions in array on my
website "Number of Dimensions" My routine trials until it errors - just as you say. -- Rob van Gelder - http://www.vangelder.co.nz/excel "AA2e72E" wrote in message ... There is no built-in support for finding the dimensions of an array in VBA/VB without prior knowledge of its rank (number of dimensions). The nearest solution is to do it by trial and error. "Alan Beban" wrote: NickHK wrote: ajitpalsingh200, Dim ArrayItemCount as Long ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) NickHK The above works for a 1-based array; to allow for a 0-based or 1-based array, substitute ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) + 1 Alan Beban "ajitpalsingh200" wrote in message ... How do i count the number of items in array lets say i have declaration as below DiscreteData = Array("MPN", "Vendor") How do i count the items? thankx in adavance -- ajitpalsingh200 ------------------------------------------------------------------------ ajitpalsingh200's Profile: http://www.excelforum.com/member.php...o&userid=16150 View this thread: http://www.excelforum.com/showthread...hreadid=320512 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting items in an array
If you simply want the count of the number of elements in an array,
irrespection of the humber of dimensions it has, try: Sub xy() For Each ele In xx cnt = cnt + 1 Next End Sub "Rob van Gelder" wrote: I have an example of how to determine number of dimensions in array on my website "Number of Dimensions" My routine trials until it errors - just as you say. -- Rob van Gelder - http://www.vangelder.co.nz/excel "AA2e72E" wrote in message ... There is no built-in support for finding the dimensions of an array in VBA/VB without prior knowledge of its rank (number of dimensions). The nearest solution is to do it by trial and error. "Alan Beban" wrote: NickHK wrote: ajitpalsingh200, Dim ArrayItemCount as Long ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) NickHK The above works for a 1-based array; to allow for a 0-based or 1-based array, substitute ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) + 1 Alan Beban "ajitpalsingh200" wrote in message ... How do i count the number of items in array lets say i have declaration as below DiscreteData = Array("MPN", "Vendor") How do i count the items? thankx in adavance -- ajitpalsingh200 ------------------------------------------------------------------------ ajitpalsingh200's Profile: http://www.excelforum.com/member.php...o&userid=16150 View this thread: http://www.excelforum.com/showthread...hreadid=320512 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counting items in an array
If you simply want the count of the number of elements in an array,
irrespection of the humber of dimensions it has, try: Sub xy() cnt = 0 For Each ele In YourArray cnt = cnt + 1 Next End Sub "Rob van Gelder" wrote: I have an example of how to determine number of dimensions in array on my website "Number of Dimensions" My routine trials until it errors - just as you say. -- Rob van Gelder - http://www.vangelder.co.nz/excel "AA2e72E" wrote in message ... There is no built-in support for finding the dimensions of an array in VBA/VB without prior knowledge of its rank (number of dimensions). The nearest solution is to do it by trial and error. "Alan Beban" wrote: NickHK wrote: ajitpalsingh200, Dim ArrayItemCount as Long ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) NickHK The above works for a 1-based array; to allow for a 0-based or 1-based array, substitute ArrayItemCount =UBound(DiscreteData)-LBound(DiscreteData) + 1 Alan Beban "ajitpalsingh200" wrote in message ... How do i count the number of items in array lets say i have declaration as below DiscreteData = Array("MPN", "Vendor") How do i count the items? thankx in adavance -- ajitpalsingh200 ------------------------------------------------------------------------ ajitpalsingh200's Profile: http://www.excelforum.com/member.php...o&userid=16150 View this thread: http://www.excelforum.com/showthread...hreadid=320512 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Counting Items | Excel Worksheet Functions | |||
Array: Counting multiple values within array | Excel Worksheet Functions | |||
Counting the items | Excel Worksheet Functions | |||
vba - counting different items | Excel Programming | |||
Counting items | Excel Programming |