+ Reply to Thread
Results 1 to 3 of 3

Arrays and Functions

  1. #1
    Forum Contributor
    Join Date
    02-26-2012
    Location
    Ottawa, ON
    MS-Off Ver
    Excel 2007
    Posts
    129

    Arrays and Functions

    Hello,

    My problem is still kind of confusing because I am still trying to figure out exactly what it is I want to do.

    I have multiple columns of data. I would like to plot each column against time. However, these columns in the future may be made longer, and I would like to "do math" in some of these columns. I don't want "the math" to update the columns.

    Therefore, I had the idea of making arrays. I could find the number of rows in the columns, pass that number as the number of elements in the array to a function (which does the math I want) and return that array.

    Anyhow, I am getting errors! A subscript out of range error.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,450

    Re: Arrays and Functions

    Hi,

    Here are some quick observations:
    Arrays need to be Dim as Variant
    Arrays are zero based, meaning they start with Ary(0) not Ary(1)

    You can find the lower and upper bound of an array by using LBound(Ary) and UBound(Ary) to see how big the array is.

    The above hints might lead you to finding your "subscript out of range" problem.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    02-26-2012
    Location
    Ottawa, ON
    MS-Off Ver
    Excel 2007
    Posts
    129

    Re: Arrays and Functions

    Thank you! That certainly cleared up a lot of my problems.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA Arrays-A few useful functions
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-28-2013, 08:09 PM
  2. which functions can use arrays?
    By Jack Cheung in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-22-2013, 02:06 AM
  3. Using stats functions on arrays
    By hamhains in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2011, 01:52 PM
  4. Functions and arrays
    By Pluppen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-28-2008, 08:38 AM
  5. [SOLVED] Arrays parameters in Functions
    By BruceK in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM

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