+ Reply to Thread
Results 1 to 2 of 2

Creating An Array to Be Used In a User Defined Function

  1. #1
    Registered User
    Join Date
    09-05-2011
    Location
    St. John's, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    Question Creating An Array to Be Used In a User Defined Function

    Hey Everyone,

    I'm not sure if its possible to do what I am asking but here goes.

    I've created a function that does a "Cash Calculation" on one set of data.

    Please Login or Register  to view this content.
    Eventually though, I will need to do this calculation for 30+ sets of data. For each row in the spread sheet there would be numerous times when I would need to either add or subtract from the return value.

    So my question is this. Can I use an array to do this calculation across the 30+ sets of data. For example, instead of the "CurSignal" being one variable it would be an array. The code would then go through a loop taking the first value of each array, doing the calculations of the "ReturnValue", then move on to the second value of each array and looping over and over until all data sets are analyzed and returning a final value.

    I'm thinking of it similar to how the SUM Function works in excel, it doesn't care how many cells I use... it adjusts for the calculation, once it has received the array.

    I've attached a sample spread sheet to explain. Currently the function has been used with Data Set 2, imagine if you will I wanted to use this calculation with both data sets, then maybe 5 data sets, then maybe 25.

    Thoughts anyone? Am I in over my head?
    Attached Files Attached Files

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Creating An Array to Be Used In a User Defined Function

    I reckon you could, but your current approach is simple and transparent; you can see all the intermediate results, which I would find reassuring.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    09-05-2011
    Location
    St. John's, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Creating An Array to Be Used In a User Defined Function

    Any idea how I might implement this? I haven't used arrays before?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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