+ Reply to Thread
Results 1 to 7 of 7

Array Ubound

  1. #1
    Forum Contributor
    Join Date
    01-19-2006
    Posts
    142

    Array Ubound

    Hi all,

    I have filled a 2d array with values - can i find out the size of the array WHERE Arry(1, i) = 'WB01' - for example.

    TIA

  2. #2
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187
    Are you asking how to count the number of occurances where the array contains "WB01"

    regards

  3. #3
    Forum Contributor
    Join Date
    01-19-2006
    Posts
    142
    yes i am,

    suppose I would just loop through the entire array and set up a count where array = 'WB01' - thought I might just be able to use ubound with a criteria set on it?

  4. #4
    Bob Phillips
    Guest

    Re: Array Ubound

    UBound(Arry,1)

    and

    UBound(Arry,2)

    for the two dimensions of the array

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "gti_jobert" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi all,
    >
    > I have filled a 2d array with values - can i find out the size of the
    > array WHERE Arry(1, i) = 'WB01' - for example.
    >
    > TIA
    >
    >
    > --
    > gti_jobert
    > ------------------------------------------------------------------------
    > gti_jobert's Profile:

    http://www.excelforum.com/member.php...o&userid=30634
    > View this thread: http://www.excelforum.com/showthread...hreadid=526695
    >




  5. #5
    Bob Phillips
    Guest

    Re: Array Ubound

    You could drop it onto a spreadsheet and count those

    Range("M1:N10") = arry
    MsgBox Application.CountIf(Range("M1:N10"), "WB01")


    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "gti_jobert" <[email protected]> wrote
    in message news:[email protected]...
    >
    > yes i am,
    >
    > suppose I would just loop through the entire array and set up a count
    > where array = 'WB01' - thought I might just be able to use ubound with
    > a criteria set on it?
    >
    >
    > --
    > gti_jobert
    > ------------------------------------------------------------------------
    > gti_jobert's Profile:

    http://www.excelforum.com/member.php...o&userid=30634
    > View this thread: http://www.excelforum.com/showthread...hreadid=526695
    >




  6. #6
    Tushar Mehta
    Guest

    Re: Array Ubound

    UBound provides the current upper bound of the specified dimension of the
    array.

    I suspect there is nothing faster than looping through the array. Set it up
    as a function that accepts the array and the target string as arguments and
    you will have a reusable routine.


    --
    Regards,

    Tushar Mehta
    www.tushar-mehta.com
    Excel, PowerPoint, and VBA add-ins, tutorials
    Custom MS Office productivity solutions

    In article <[email protected]>,
    [email protected] says...
    >
    > yes i am,
    >
    > suppose I would just loop through the entire array and set up a count
    > where array = 'WB01' - thought I might just be able to use ubound with
    > a criteria set on it?
    >
    >
    > --
    > gti_jobert
    > ------------------------------------------------------------------------
    > gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
    > View this thread: http://www.excelforum.com/showthread...hreadid=526695
    >
    >


  7. #7
    Alan Beban
    Guest

    Re: Array Ubound

    If the functions in the freely downloadable file at
    http://home.pacbell.net/beban are available to your workbook

    ArrayCountIf(Arry,"WB01") will return the number of occurrences.

    Alan Beban

    gti_jobert wrote:
    > yes i am,
    >
    > suppose I would just loop through the entire array and set up a count
    > where array = 'WB01' - thought I might just be able to use ubound with
    > a criteria set on it?
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1