Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Non repeating random numbers

I have a much larger range but for the this example I only use 10 cells.
I need to pull random numbers from a range without repeating any of them
INDEX(A$1:A$10,RAND()*10+1
This works but it obviously is prone to picking repeats.How can I do
this with a formula without repeating..I can't use a VBA solution in
this spreadsheet.I can put a big clunky If in there to check each one
but theres got to be a cleaner way.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Non repeating random numbers

Here the trick. Say you have numbers in A1 thru A100 and you want to sample
ten of them with any repeats. In B1 thru B100 enter the formula:

=RAND()

then sort cols A & B by B.

This will scramble the material in column A.

Just pick the first 10 items.
--
Gary''s Student
gsnu200703


"Rowland" wrote:

I have a much larger range but for the this example I only use 10 cells.
I need to pull random numbers from a range without repeating any of them
INDEX(A$1:A$10,RAND()*10+1
This works but it obviously is prone to picking repeats.How can I do
this with a formula without repeating..I can't use a VBA solution in
this spreadsheet.I can put a big clunky If in there to check each one
but theres got to be a cleaner way.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Non repeating random numbers

Do to the end users of this SS I can't use that approach,it has to be
automated.

Here the trick. Say you have numbers in A1 thru A100 and you want to
sample
ten of them with any repeats. In B1 thru B100 enter the formula:


=RAND()


then sort cols A & B by B.


This will scramble the material in column A.


Just pick the first 10 items.
-- Gary''s Student gsnu200703 "Rowland" wrote:
I have a much larger range but for the this example I only use 10

cells.
I need to pull random numbers from a range without repeating any of

them
INDEX(A$1:A$10,RAND()*10+1
This works but it obviously is prone to picking repeats.How can I do
this with a formula without repeating..I can't use a VBA solution in
this spreadsheet.I can put a big clunky If in there to check each one
but theres got to be a cleaner way.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Non repeating random numbers

Rowland wrote:
I have a much larger range but for the this example I only use 10 cells.
I need to pull random numbers from a range without repeating any of them
INDEX(A$1:A$10,RAND()*10+1
This works but it obviously is prone to picking repeats.How can I do
this with a formula without repeating..I can't use a VBA solution in
this spreadsheet.I can put a big clunky If in there to check each one
but theres got to be a cleaner way.



OK I think I have solved my problem with only adding one column
I add a column and enter Rand() down B1:B10(and then hide it)
In the C column where I need 10 non repeating random numbers from A1:A10
I use this formula
=INDIRECT("A"&RANK(B1,B$1:B$10))
It gets the Rank of the rand()number in B column(1 to 10) and uses that
with the indirect function to return a value from the A Column
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generate Random numbers from a pre-defined set frankjh19701 Excel Worksheet Functions 0 January 11th 07 05:20 PM
Generate Random numbers from a pre-defined set frankjh19701 Excel Worksheet Functions 0 January 11th 07 05:20 PM
Generation of random numbers and sum of those with a condition ramana Excel Worksheet Functions 11 October 5th 05 05:01 AM
Random Numbers anuterrnd Excel Worksheet Functions 1 July 22nd 05 05:32 AM
Random list (1-45) without repeating numbers? Hayes Excel Worksheet Functions 1 November 21st 04 10:01 PM


All times are GMT +1. The time now is 01:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"