"Random sort" a selection?

E

Ed

I'd like to select a range of cells down a single column, and resort the
values in a random order, but within the same cells. Is that easy enough to
do?

Ed
 
P

Pete_UK

I suppose you could insert a random number in the column next to your
data and then sort both columns of data based on the random column,
then delete the column of random numbers.

Hope this helps.

Pete
 
O

Opinicus

Pete_UK said:
I suppose you could insert a random number in the column next to your
data and then sort both columns of data based on the random column,
then delete the column of random numbers.


The trouble with that is that you'd still need a way to generate a
randomized arrangement of all the integers from 1 to n, where n is the
number of items in the set being randomized. For example, suppose I have ten
items that I want to put in random order. I can't simply generate 10 random
numbers in the range 0-9 because of the likelihood of duplications. (With
even as few as 10 items, the probability of NO duplications in my 10 random
numbers is only 10!/(10^10) and the probability of one or more duplications
is 1-(10!/(10^10)) or 99.94%

So how *does* one randomize the order of a selection in Excel?
 
P

Pete_UK

If you want, say, 10 random numbers, they could cover any range (eg 1 -
1000, or .0001 to .9999) which is bigger than the number that you want,
and they don't have to be integers. The larger the range, the less
chance there is of duplications. Anyway, if there are duplicates, then
so what? You still get a random distribution (well, as random as the
Excel random generator produces!)

Pete
 
D

Dave Peterson

And if you use =rand(), you'll see a number between 0 and 1.

And with excel giving 15 digits in those numbers, the probability of a duplicate
would be pretty small.
 
O

Opinicus

Dave Peterson said:
And if you use =rand(), you'll see a number between 0 and 1.
And with excel giving 15 digits in those numbers, the probability of a
duplicate
would be pretty small.

Thanks for pointing that out. (It's obvious when I think about it.) I tried
it and it works perfectly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top