+ Reply to Thread
Results 1 to 10 of 10

Randomly sorting the data :confused:

  1. #1
    Registered User
    Join Date
    05-18-2010
    Location
    Zurich
    MS-Off Ver
    Excel 2007
    Posts
    12

    Exclamation Randomly sorting the data :confused:

    hello,

    For an urgent project, I want to do the following:
    1. Randomly sort the data (rows)
    2. Copy the value of another cell (that performs some calculation)
    3. repeat this 5000 times

    --> receive a list of 5000 values by randomly shuffling my data


    this should not be that difficult, but I have no experience whatsoever with macro programming. Can you tell me which commands you would use for the shuffling and copying of the data, maybe I can figure out how to implement it.

    thanks a lot

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Randomly sorting the data :confused:

    How can you know how difficult it is if you don't know anything about programming?!

    So, have you got data in say A1:A100 and you want to mix them up? I don't follow point 2. Perhaps attach a sample?

  3. #3
    Registered User
    Join Date
    05-18-2010
    Location
    Zurich
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Randomly sorting the data :confused:

    Quote Originally Posted by StephenR View Post
    How can you know how difficult it is if you don't know anything about programming?!

    So, have you got data in say A1:A100 and you want to mix them up? I don't follow point 2. Perhaps attach a sample?
    Thanks for your answer,
    I've uploaded my problem for you, I hope this makes it clear:
    http://rapidshare.com/files/38877761...o_problem.xlsx

    you can see the rows 2 to 59 contain the data. Out of these, a single number (cell I69) is then calculated below. What I need in step 2 is to collect this value after each shuffling, to create a large list.
    Last edited by lexluthor; 05-18-2010 at 10:41 AM.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Randomly sorting the data :confused:

    Please Login or Register  to view this content.
    This will transfer the value to sheet2. What needs to be randomised - could every cell in C2:O59 be mixed up?

  5. #5
    Registered User
    Join Date
    05-18-2010
    Location
    Zurich
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Randomly sorting the data :confused:

    Only the order of rows should be randomized, it is important that within an individual row, the set of data (collumn D to O) remains the same. Or in other words, the whole goal is to shuffle the label "observed" and "expected" in the two groups that are statistically compared.
    Last edited by lexluthor; 05-18-2010 at 11:03 AM.

  6. #6
    Registered User
    Join Date
    08-29-2007
    Posts
    47

    Re: Randomly sorting the data :confused:

    Here's one way to go about completing this;

    I recorded a macro of the following:

    1. Add a new column from P2:P59 filled with random numbers
    2. Sort A1:P59 based off of the random numbers
    3. Take I69 and copy and paste its value into a new sheet

    Then - I repeated it 5000 times. This took about 5 minutes to run on my crappy old laptop.

    In the end, just a little bit of cleaning up and you should have your list!

    Please Login or Register  to view this content.
    Here's my take - there may be a better way though.

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Randomly sorting the data :confused:

    werfnort - I've basically stolen your idea (sorry) but just shortened it a little:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-29-2007
    Posts
    47

    Re: Randomly sorting the data :confused:

    No problem StephenR - there's a reason you're a Guru and I'm not!

  9. #9
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Randomly sorting the data :confused:

    I had to put 50 quid in a brown envelope for someone.

  10. #10
    Registered User
    Join Date
    05-18-2010
    Location
    Zurich
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Randomly sorting the data :confused:

    hey thank you all very much!
    I'll try it out tomorrow, too tired now...

    I hope I can become a guru like you some day

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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