+ Reply to Thread
Results 1 to 4 of 4

Macro to sum of all the row of a named range and store in a single dimensional array

  1. #1
    Registered User
    Join Date
    03-21-2014
    Location
    Dhaka
    MS-Off Ver
    Excel 2013
    Posts
    3

    Macro to sum of all the row of a named range and store in a single dimensional array

    Hi,

    I have been using excel macro via macro recorder. However, I have an unique problem in hand where I require vba language hand ons. The issue is as under:

    I have defined two named ranges: 1) Forecast 2) Actual

    Now what I am looking for is a macro that would sum each row of forecast and each row of actual separately and take the absolute of these two sums and then store them in a array for further calculations.

    To explain it further it would be like:
    Absolute(Sum of row 1 of Actual - Sum of row 1 of Forecast) and then store the result in the first row of array
    ...repeat for n number of rows (as defined during naming the two tables)

    Hope I am able to explain. Please let me know if there's further info required.


    Rgds qomarf

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to sum of all the row of a named range and store in a single dimensional array

    Try something like this..

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    03-21-2014
    Location
    Dhaka
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Macro to sum of all the row of a named range and store in a single dimensional array

    Hey Alpha,

    Thanks! I worked my way from your codes. One last question- how do you turn this into formula i.e. Function ()? For example I want see the sum of the Absolute array by entering formula into a cell example: by inserting "=Testformula()" in any cell within the workbook where I have created the module will give me the sum of Absolute array.

    Rgds Qomarf

  4. #4
    Registered User
    Join Date
    03-21-2014
    Location
    Dhaka
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Macro to sum of all the row of a named range and store in a single dimensional array

    The issue has been addressed and solved.

+ 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. Populate a Single Dimensional Array with two Dim Array (matrix)
    By Benjamin1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-03-2011, 12:49 PM
  2. multi-dimensional array to single column
    By pcm2004 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-13-2011, 06:50 PM
  3. Multi-Dimensional Named Array
    By yawnzzzz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-22-2008, 12:28 PM
  4. Selecting a single column of a multi-dimensional array
    By hmatharo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2008, 11:10 PM
  5. Mutli-dimensional Array to Single-Dimension Array
    By Blue Aardvark in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2005, 05: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