Someone asked me if I could use Excel to take a table of information and put it into a new table randomly. Without thinking about it too hard I said "Yeah, I bet I could do that." Turns out I spoke too soon.
Assume a 10 X 10 array, filled with data (for my test runs, I've been using the cell addresses as the data, so A1 has "A1" in it, B2 has "B2", etc.) The task is to populate a new 10 X 10 array with the same data, but in random order.
I'm not having any trouble with the randomness part, I've got a couple of solutions working for generating random cell references. I am having trouble making sure that every reference is generated at least once and only once. Thinking about it another way, I want to generate the numbers 1-100 in random order without any number repeating.
I have come up with a really cludgy solution where I generate enough random numbers to make sure that every number comes up at least once and then filter that list to remove repeats. (thanks to
this thread)
But, I was hoping for something a little more elegant that that. I'd also like it to work automatically and I haven't been able to create a Macro that will automate that filtering operation. Oh, and I also don't know how many data elements will be in the table that needs to be randomized, and, while stats was a long time ago, I bet I'd need a lot of random numbers to be sure of generating every number from 1-1000, for example.
So, any ideas?
posted by enn at 11:43 AM on May 13, 2008