+ Reply to Thread
Results 1 to 4 of 4

Using Conditional Sums/Averages on Arrays

  1. #1
    ExcelMonkey
    Guest

    Using Conditional Sums/Averages on Arrays

    I have two arrays that are 3D. Each dimension is populated within Three tier
    For Next loop. The first array has data, the second array has dates
    associated with its companion element in the first array:

    DataArray1(0,0,0) and DateArray2(0,0,0) are related.

    I want to Average and or SUM the column data from:
    DataArray1(0,0,0) to DataArray1(1000,100,0)
    using a conditional logic on the dates in the DateArray

    I want to use something similar to the SUMPRODUCT formula using the unitary
    operators "--". I am trying to avoid using Pivot Tables if possible.
    Perhaps even a function would work.

    Any ideas on how I do this?

    Thanks

  2. #2
    Tom Ogilvy
    Guest

    Re: Using Conditional Sums/Averages on Arrays

    In VBA, SUMPRODUCT can not be used as an array formula (which is what you
    describe). You would need to pass a virtual formula to the evaluate method.
    However, it won't work on a 3D array nor will anything slice a 2D array out
    of a 3D array as a single command.

    That said, looping through the array and building your own result should be
    very fast.

    --
    Regards,
    Tom Ogilvy

    "ExcelMonkey" <[email protected]> wrote in message
    news:[email protected]...
    > I have two arrays that are 3D. Each dimension is populated within Three

    tier
    > For Next loop. The first array has data, the second array has dates
    > associated with its companion element in the first array:
    >
    > DataArray1(0,0,0) and DateArray2(0,0,0) are related.
    >
    > I want to Average and or SUM the column data from:
    > DataArray1(0,0,0) to DataArray1(1000,100,0)
    > using a conditional logic on the dates in the DateArray
    >
    > I want to use something similar to the SUMPRODUCT formula using the

    unitary
    > operators "--". I am trying to avoid using Pivot Tables if possible.
    > Perhaps even a function would work.
    >
    > Any ideas on how I do this?
    >
    > Thanks




  3. #3
    ExcelMonkey
    Guest

    Re: Using Conditional Sums/Averages on Arrays

    "You would need to pass a virtual formula to the evaluate method."

    If I were to do this, and my data was in a 2D array, what would this look
    like? I have seen the Evaluate Method used with formulas relating to cells.
    But as my data is in an array could I pursue the Evalutate method?




    "Tom Ogilvy" wrote:

    > In VBA, SUMPRODUCT can not be used as an array formula (which is what you
    > describe). You would need to pass a virtual formula to the evaluate method.
    > However, it won't work on a 3D array nor will anything slice a 2D array out
    > of a 3D array as a single command.
    >
    > That said, looping through the array and building your own result should be
    > very fast.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "ExcelMonkey" <[email protected]> wrote in message
    > news:[email protected]...
    > > I have two arrays that are 3D. Each dimension is populated within Three

    > tier
    > > For Next loop. The first array has data, the second array has dates
    > > associated with its companion element in the first array:
    > >
    > > DataArray1(0,0,0) and DateArray2(0,0,0) are related.
    > >
    > > I want to Average and or SUM the column data from:
    > > DataArray1(0,0,0) to DataArray1(1000,100,0)
    > > using a conditional logic on the dates in the DateArray
    > >
    > > I want to use something similar to the SUMPRODUCT formula using the

    > unitary
    > > operators "--". I am trying to avoid using Pivot Tables if possible.
    > > Perhaps even a function would work.
    > >
    > > Any ideas on how I do this?
    > >
    > > Thanks

    >
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: Using Conditional Sums/Averages on Arrays

    No. Not unless it were very small any you could write the array out as you
    would in a formula in a cell. I was really addressing the use of sumproduct
    as an array formula in general. Again, looping through an array is
    extremely fast.

    --
    Regards,
    Tom Ogilvy


    "ExcelMonkey" <[email protected]> wrote in message
    news:[email protected]...
    > "You would need to pass a virtual formula to the evaluate method."
    >
    > If I were to do this, and my data was in a 2D array, what would this look
    > like? I have seen the Evaluate Method used with formulas relating to

    cells.
    > But as my data is in an array could I pursue the Evalutate method?
    >
    >
    >
    >
    > "Tom Ogilvy" wrote:
    >
    > > In VBA, SUMPRODUCT can not be used as an array formula (which is what

    you
    > > describe). You would need to pass a virtual formula to the evaluate

    method.
    > > However, it won't work on a 3D array nor will anything slice a 2D array

    out
    > > of a 3D array as a single command.
    > >
    > > That said, looping through the array and building your own result should

    be
    > > very fast.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "ExcelMonkey" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I have two arrays that are 3D. Each dimension is populated within

    Three
    > > tier
    > > > For Next loop. The first array has data, the second array has dates
    > > > associated with its companion element in the first array:
    > > >
    > > > DataArray1(0,0,0) and DateArray2(0,0,0) are related.
    > > >
    > > > I want to Average and or SUM the column data from:
    > > > DataArray1(0,0,0) to DataArray1(1000,100,0)
    > > > using a conditional logic on the dates in the DateArray
    > > >
    > > > I want to use something similar to the SUMPRODUCT formula using the

    > > unitary
    > > > operators "--". I am trying to avoid using Pivot Tables if possible.
    > > > Perhaps even a function would work.
    > > >
    > > > Any ideas on how I do this?
    > > >
    > > > Thanks

    > >
    > >
    > >




+ 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