+ Reply to Thread
Results 1 to 8 of 8

Recording values of multiple iterations

  1. #1
    Registered User
    Join Date
    04-24-2014
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2013
    Posts
    4

    Recording values of multiple iterations

    Hey everyone,

    So I have a table which is being generated by a certain function along with a randomly generated number. The value I'm interested in is the sum of the whole table. Now what I want to do is generate a random number X (in this case 100) times and record the sum of the table every iteration. So far I've only managed to "copy" --> "paste value" 100 times and this gives me the required result however this takes a lot of time and clicking and frankly it's making me feel quite ashamed.

    Is there an efficient way that excel can do this for me? A couple of internet searches have pointed towards a macro however I've been playing around with this and my limited Matlab knowledge is not getting me very far.

    I've been tempted to just run my data through another program, but this is an Excel based project.

    Thanks!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Recording values of multiple iterations

    With a little more detail, we can make a simple macro simulator that runs your sheet for you, however many loops you wish.


    1) What are the criteria for the "random" number? The range? Are duplicate numbers allowed in the random generation, meaning we don't care what the random numbers are within the criteria?

    2) What sheet name is all this running on?

    3) What cell should the random number be entered into?

    4) What cell(s) should then be summed on each iteration?

    5) Where should the final results be placed? Do you want all the individual results recorded as well, or just the final result each time?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-24-2014
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Recording values of multiple iterations

    Thanks for the quick reply!

    1) What are the criteria for the "random" number? The range? Are duplicate numbers allowed in the random generation, meaning we don't care what the random numbers are within the criteria?

    Yes duplicate numbers are allowed, I simply used the rand() function to generate these.

    We're performing volume estimates on a reservoir so there are about 4 steps (sheets) before this "final step". If possible the function should perform a similar action as the "calculate now" button and then record the sum of the table.


    2) What sheet name is all this running on?

    The sheet which contains the necessary information is called GRV.


    3) What cell should the random number be entered into?

    Right now I'm generating the random number in cell H2.


    4) What cell(s) should then be summed on each iteration?

    Cells B20:O34

    5) Where should the final results be placed? Do you want all the individual results recorded as well, or just the final result each time?

    Preferably just in a column on the same sheet say S1:S100. All I'm interested in is the final sum during each iteration, so 100 values.


    Hope this is enough information

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Recording values of multiple iterations

    TO be clear, you're wanting to just "Calculate Now" to cause the existing RAND() function to change, then capture the sum of all the cells into S1, then Calculate Now and capture the sum in S2, etc?

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Recording values of multiple iterations

    THus, I would think something like this:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-24-2014
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Recording values of multiple iterations

    Yes, that's it! Pretty simple right? Maybe there's a way to do this without a macro? Everytime we change a parameter in the previous steps we need another 100 iterations which is why I'm desperately looking for a way to automate this.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Recording values of multiple iterations

    To force a sheet to calculate 100 times and record the answers somewhere static, that requires a macro.

  8. #8
    Registered User
    Join Date
    04-24-2014
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Recording values of multiple iterations

    Wow that runs perfectly! We need to run 10000 iterations of the final volumetrics estimate so this is great. Thank you very much.

+ 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. Replies: 10
    Last Post: 02-12-2014, 04:14 AM
  2. excel memory overload after multiple iterations
    By rossg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2013, 01:16 AM
  3. Reformatting a sheet with many iterations of a similar grouping of dates and values
    By Bobby Green in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-14-2013, 02:19 PM
  4. Multiple categories, Looping iterations and deleting rows
    By Glenn Kennedy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2012, 06:46 AM
  5. help please : counting iterations based on multiple criterias
    By ccoindy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-11-2007, 11:40 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