+ Reply to Thread
Results 1 to 4 of 4

Combine - by summing - two arrays into a third

  1. #1
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Combine - by summing - two arrays into a third

    Hi,

    I know a few ways to accomplish the task but I'm curious to know if there is a syntax which will "Do it My Way".
    The following code will fill Arr1 cells with 10 values from range A1:A10 and then fill F1:F10 with those values.

    Please Login or Register  to view this content.

    Now, assume 2 ranges (A1:A10 and B1:B10)
    Putting each range into an Array is easy - as shown in the 2 first commands of the following code.

    I want to add cell 1 of Arr1 with cell 1 of Arr2 and put the result in cell 1 of Arr3
    I have tried:

    Please Login or Register  to view this content.

    Is there a way to fill Arr3 with Arr1 & Arr2 cells sum with a single command (WITHOUT LOOPING) ?.

    'Join' and 'Split' don't seem to do any good.

    Thanks, Elm
    Last edited by ElmerS; 03-25-2010 at 03:34 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Combine - by summing - two arrays into a third

    Quote Originally Posted by ElmerS
    Is there a way to fill Arr3 with Arr1 & Arr2 cells sum with a single command (WITHOUT LOOPING) ?.
    Not that I'm aware of.

    Though this will invariably fall foul of your specific requirements I would (for the benefit of others) suggest using Evaluate...

    Please Login or Register  to view this content.
    or if you want to store as an Array

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Combine - by summing - two arrays into a third

    Thank you.

  4. #4
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Combine - by summing - two arrays into a third

    It seems as if the following will also do:

    [F1:F10] = [A1:A10+B1:B10]

    Elm

+ 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