+ Reply to Thread
Results 1 to 9 of 9

summing random numbers

  1. #1
    Registered User
    Join Date
    09-23-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    16

    summing random numbers

    I have a process that generates the value X in cell A1 randomly. So I can change the value of X in A1 by clicking on F9. I want to sum a sequence of X values. I can do this by manually copying each X to a row of cells and then summing the row values. But that is tedious. Can the summation be done automatically without being regarded as being circuler?

  2. #2
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: summing random numbers

    I have attached a workbook that accomplishes what you ask via a button and macro. When you click the button, it will generate a random number in cell A1, and add that random number's value to the total in B1.

    The first time you click it, the values will be identical. Once you click it a second time, a new random number will be placed in A1, with it's value added to the current value in B1. Hope it is what you were looking to do.

    - Moo
    Attached Files Attached Files

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: summing random numbers

    another option is just to repeat what's in a1 so if you wanted to find out how many times "x" is generated after say 100 f9's
    just fill down 100 rows and countif(a1:a100,"x") press f9 once random is random after all
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: summing random numbers

    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    09-23-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: summing random numbers

    Moo
    Thank you for that. I have downloaded it and used it in a trial. However, the value I have in my A1 is produced by a calculation using a list of random numbers and a new calculation is carried out when I click F9. Clicking your button just generates a random number in A1 but does not carry our my calculation. How do I link the two? I copied your Random Number Addition to my workbook but this did not copy the button so I could only try out the down load.

  6. #6
    Registered User
    Join Date
    09-23-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: summing random numbers

    If I repeat (copy) A1 to a column of cells, every time I press F9, every cell in the column gets the new value in A1. Am I misinterpreting your instruction?

  7. #7
    Registered User
    Join Date
    09-23-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: summing random numbers

    Thank you, Tony Valko
    I will learn about macros so I can address my problem

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: summing random numbers

    You're welcome. Thanks for the feedback!

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: summing random numbers

    just to reiterate putting randbetween(1,15) in a1 then pressing f9 100 times to see how many times say 6 comes up
    then counting each time so in 100 presses of f9 you get 12 lots of 6 so the answer is 6 came up 12 times
    is just the same as putting randbetween(1,15) in cells a1:a100 press f9 once then count how many of those are 6

+ 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. Generating a list of Random numbers of random length...
    By Growl in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2013, 12:10 PM
  2. [SOLVED] summing up random results in dependance on their values
    By canis01 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-16-2013, 05:48 AM
  3. Generating a Random Number of Random Numbers
    By Garrus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2010, 09:39 AM
  4. Non-random numbers generated by excel's data analysis random gener
    By Allie in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-17-2005, 02:05 AM
  5. Replies: 2
    Last Post: 09-13-2005, 12:05 PM

Tags for this Thread

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