+ Reply to Thread
Results 1 to 3 of 3

Simulated X & Y data for 100,000 rows

  1. #1
    Registered User
    Join Date
    08-20-2016
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    18

    Simulated X & Y data for 100,000 rows

    Hi,

    I need a VBA script/Excel solution which will simulate random data for X and Y whereby:

    1. 99.9999%>Y>10.001% and 1000>X>1.
    2. X randomly increases as Y randomly increases

    E.g. output:

    Index X Y
    1 70 18.63342575
    2 127 22.34908535
    3 168 23.10441084
    4 205 23.65640589
    5 257 27.96461442
    6 297 30.14763945
    7 356 35.34742094
    8 389 43.2011556


    See the file attached for what the output should look like and what the X and Y plot should look like.

    Please, your help would be VERY, VERY GREATLY appreciated.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,844

    Re: Simulated X & Y data for 100,000 rows

    Here's how I would probably approach this:

    1) Enter desired starting value for X in A2 and Y in B2, or generate them randomly using one of Excel's built in random number generators (RANDBETWEEN() or RAND())
    2) In C2, generate a random number using RANDBETWEEN() that represents the change in X.
    3) In D2, generate a random number using RAND() that represents the change in Y. Note that, since you appear to want these numbers to be something other than 0 to 1, you will need to note the formula used to get a random real between a and b (see help file https://support.office.com/en-us/art...0-021ea9f5be73 ).
    4) In A3, enter =A2+C2. Copy to B3 and then copy down as far as needed.
    5) Note that, somewhere in steps 3 and 4, you will need a small algorithm to make sure X and Y don't exceed the limits you have imposed on them. I am not sure what rule(s) you would want to use here. I could see something in the choices for a and b that dictates the limits of the random number generators in C and D, or perhaps including simple MIN() and MAX() functions in A and B that keep the numbers from exceeding their limits.

    That's an overview of how I would probably do this. The hardest part is probably developing step 3 -- the exact rules and limits you want to put on the random number generators. At this point, I will assume you know better than I do what those rules and limits ought to be and can implement them, rather than me trying to guess what those rules and limits ought to be.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    08-08-2014
    Location
    Lancaster, PA
    MS-Off Ver
    2016 (windows & mac)
    Posts
    94

    Re: Simulated X & Y data for 100,000 rows

    have a go with this

    Please Login or Register  to view this content.
    you can set the bounds for X & Y as well as the # of rows required in the code; you could easily adjust the code to retrieve these values from cells on the worksheet if they were something that needed to change regularly.

    for the second requirement I adjust the upper and lower bounds for X based on the output of Y. my adjustment is relatively crude and am sure there are better ways to keep these numbers aligned, but it should be pretty easy to adjust as you see fit.

    I have uploaded a copy of the file which contains the code.

    the other change I made to the file was to create a dynamic Named Range (see this) for the data called DataSet, this will adjust to the number of rows of data you have, you can then point your chart at that Named Range so that it adjusts to whatever number of rows you generate.

    note: I set the # of rows to 1000 in the attached file to keep the file size down so the site would accept the upload, a chart with 100,000 points made the file size too large to upload!
    Attached Files Attached Files
    Last edited by thatandyward; 07-11-2017 at 11:28 AM.

+ 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. Simulated Elapsed Timer with refresh control
    By icyrius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2015, 10:06 AM
  2. Replies: 4
    Last Post: 09-16-2014, 10:48 AM
  3. Replies: 6
    Last Post: 08-18-2012, 05:00 AM
  4. Help recording simulated output
    By ddub25 in forum Excel General
    Replies: 7
    Last Post: 06-16-2012, 12:27 PM
  5. Q: Getting average of simulated die rolls?
    By Ranger in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2007, 05:14 PM
  6. Simulated phone display
    By nythawk97 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2007, 12:33 AM
  7. Simulated file references
    By carg1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-14-2005, 02:43 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