+ Reply to Thread
Results 1 to 6 of 6

Evaluating Array Formula in VBA and sending Results Only to Spreadsheet

  1. #1
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Evaluating Array Formula in VBA and sending Results Only to Spreadsheet

    I am trying to evaluate an array formula in VBA and send only the results to my spreadsheet...

    This is the formula:

    Please Login or Register  to view this content.
    and I want it to go from Row 1 to 6000....

    I tried using Evaluate

    Please Login or Register  to view this content.
    What's the best way to get this right?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Evaluating Array Formula in VBA and sending Results Only to Spreadsheet

    Ok... I think I got it with this:

    Please Login or Register  to view this content.
    but is there a better way?

  3. #3
    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: Evaluating Array Formula in VBA and sending Results Only to Spreadsheet

    NBVC,

    That formula could be changed to

    =(-1)^AA1 * (2^AR1 + SUMPRODUCT(AJ1:AP1, 2^(AR1 - {1,2,3,4,5,6,7} ) ) + SUMPRODUCT(K1:Z1, 2^(AR1 - {8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}) ) )

    And the next one to

    =SUMPRODUCT(AB1:AI1, {128,64,32,16,8,4,2,1}) - 127
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Evaluating Array Formula in VBA and sending Results Only to Spreadsheet

    Ok, thanks shg.

    Is there a good way to VBA it other than how I did it above with the EVALUATE method?

  5. #5
    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: Evaluating Array Formula in VBA and sending Results Only to Spreadsheet

    You could insert the formulas en masse by column (eliminating the row loop), and then replace values with values. You'd have to try it to see what the performance gain is.
    Please Login or Register  to view this content.
    Last edited by shg; 05-12-2009 at 07:04 PM.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Evaluating Array Formula in VBA and sending Results Only to Spreadsheet

    Thank you, shg

+ 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