Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Random Range with no duplicates

Here is my situation: I have a list of college classes. With each class -
lets say ENGL-1301 I need to generate a series of random section numbers with
no duplicates between 9001-9099. Then on the next class such as ENGL-1302 I
need to start over with the number system. There are different numbers of
classes in one class name - lets say ENGL-1301 has 20 sections and ENGL-1302
has 9 sections.

Thanks for any help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Random Range with no duplicates

This may be the formula you are seeking
=RANDBETWEEN(9001,9099)
Skinman


"Darmahart" wrote in message
...
Here is my situation: I have a list of college classes. With each class -
lets say ENGL-1301 I need to generate a series of random section numbers
with
no duplicates between 9001-9099. Then on the next class such as ENGL-1302
I
need to start over with the number system. There are different numbers of
classes in one class name - lets say ENGL-1301 has 20 sections and
ENGL-1302
has 9 sections.

Thanks for any help!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Random Range with no duplicates

I tried that function, but it does produce duplicates. I can't have duplicate
numbers, but thanks!

"Skinman" wrote:

This may be the formula you are seeking
=RANDBETWEEN(9001,9099)
Skinman


"Darmahart" wrote in message
...
Here is my situation: I have a list of college classes. With each class -
lets say ENGL-1301 I need to generate a series of random section numbers
with
no duplicates between 9001-9099. Then on the next class such as ENGL-1302
I
need to start over with the number system. There are different numbers of
classes in one class name - lets say ENGL-1301 has 20 sections and
ENGL-1302
has 9 sections.

Thanks for any help!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Random Range with no duplicates

In E1 thru E99 enter 9001 thru 9099.
In F1 thru F99 enter =RAND()

Sort columns E & F by F

If you want three random values, pick E1, E2, and E3
If you want four random values, pick E1, E2, E3, and E4

To re-shuffle, just re-sort
--
Gary''s Student - gsnu200799
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Random Range with no duplicates

U can use this vba code:

Randomize
Cells(1, 9) = Int(99 * Rnd + 9001)
For i = 2 To 99
Do
Stopind = False
Randomize
x= Int(99 * Rnd + 9001)
Set foundCell = Range("I1", _
Range("I1").End(xlDown).Address).Find(x)
If Not (foundCell Is Nothing) Then
Stopind = True
End If
Loop Until Not Stopind
Cells(i, 9) = x
Next
--
Ak


"Darmahart" wrote:

I tried that function, but it does produce duplicates. I can't have duplicate
numbers, but thanks!

"Skinman" wrote:

This may be the formula you are seeking
=RANDBETWEEN(9001,9099)
Skinman


"Darmahart" wrote in message
...
Here is my situation: I have a list of college classes. With each class -
lets say ENGL-1301 I need to generate a series of random section numbers
with
no duplicates between 9001-9099. Then on the next class such as ENGL-1302
I
need to start over with the number system. There are different numbers of
classes in one class name - lets say ENGL-1301 has 20 sections and
ENGL-1302
has 9 sections.

Thanks for any help!





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Random Range with no duplicates

Very simple yet effective. Thanks!

"Gary''s Student" wrote:

In E1 thru E99 enter 9001 thru 9099.
In F1 thru F99 enter =RAND()

Sort columns E & F by F

If you want three random values, pick E1, E2, and E3
If you want four random values, pick E1, E2, E3, and E4

To re-shuffle, just re-sort
--
Gary''s Student - gsnu200799

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
Random generator using a range with range frequency Okstate_Fan131313 Excel Programming 3 August 4th 08 11:43 PM
Look for duplicates within a range Access Joe Excel Worksheet Functions 5 August 1st 08 09:18 PM
How to generate sets of random numbers without having duplicates William Excel Worksheet Functions 1 June 6th 06 05:30 AM
How can I create a list of random numbers with no duplicates? Kwasniewski Excel Discussion (Misc queries) 2 May 15th 06 02:44 AM
Showing a unique random number w/o duplicates tx12345 Excel Worksheet Functions 4 August 27th 05 02:51 AM


All times are GMT +1. The time now is 06:33 PM.

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"