Solved

Generate unique random numbers

Posted on 2010-08-20
7
463 Views
Last Modified: 2012-08-13
Hi,

I need something that will generate a column full of random numbers between say 1 and 50, which are unique, the number of rows to include needs to be dynamic and would prefer a formula as need to avoid vba.

Cheers
0
Comment
Question by:StormFusion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 17

Expert Comment

by:calacuccia
ID: 33489388
=RAND()*50

Put this in the range you want it to be in. Everything you hit F9, it updates.

If you want only integer number, use = Int(Rand()*50)

This might not be unique though especially if you were looking for integers.
0
 
LVL 8

Expert Comment

by:jimmyray7
ID: 33489395
There isn't a built in fuction that will do the unique part (RAND() is not unique).  However, I did find a script that will do unique - http://www.ozgrid.com/VBA/RandomNumbers.htm
0
 
LVL 17

Expert Comment

by:calacuccia
ID: 33489442
Jim,

Indeed my solution gives no unique list, as mentioned, however, he mentioned to want to avoid vba. But your looks nice.

BTW: do you know Antrat, the OzGrid guy? (Dave). We used to spend masses of time together here :-)

0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 33489478
1) List the numbers 1 through 50 in A1:A50
2) Put the following formula in cells B1:B50
=RAND()
3) To pull a set of umpteen unique random numbers, use the following formula in cell C1 then copy it down:
=INDEX($A$1:$A$50,MATCH(SMALL($B$1:$B$50,ROWS($C$1:$C1)),$B$1:$B$50,0))

Each time you hit F9, you get a different selection of random numbers

For grins, the sample workbook highlights any duplicates.

Brad
UniqueRandomNumbersQ26418995.xlsx
0
 
LVL 2

Expert Comment

by:Thomas Gibson
ID: 33490598
Quick and dirty:
http://www.random.org/integers/?num=50&min=1&max=50&col=1&unique=on&base=10&format=html&rnd=new

You can decide how many columns you want it formatted in, start number, finish number.  Easier interface than Excel.
0
 

Author Closing Comment

by:StormFusion
ID: 33492221
Perfect, simple and effectively clever, cheers
0
 
LVL 81

Expert Comment

by:byundt
ID: 33493204
StormFusion,
Thanks for the kind words and grade!
Brad
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access Database 5 48
How to parse out individual records from values in a column in Excel 1 28
Target.Address conflict in Excel VBA 3 25
Pivot Table Help 6 20
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question