Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default RAND function without duplicates?

I have a set of 20 numbers in cell A1:T1

I'm using =INDEX($A1:$T1,RAND()*COUNTA($A1:$T1)) in cell W1 to Z1 to
randomly select 4 numbers from my set. How would I modify my formula
so as to not get any duplicate's? Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default RAND function without duplicates?

See instructions at John McGimpsey's site.

http://www.mcgimpsey.com/excel/udfs/randint.html

Either Excel worksheet functions or VBA............your choice


Gord

On Mon, 18 Jun 2012 11:52:08 -0700 (PDT), JAgger1
wrote:

I have a set of 20 numbers in cell A1:T1

I'm using =INDEX($A1:$T1,RAND()*COUNTA($A1:$T1)) in cell W1 to Z1 to
randomly select 4 numbers from my set. How would I modify my formula
so as to not get any duplicate's? Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default RAND function without duplicates?

On 6/18/2012 12:29 PM, Gord Dibben wrote:
See instructions at John McGimpsey's site.

http://www.mcgimpsey.com/excel/udfs/randint.html

Either Excel worksheet functions or VBA............your choice


Gord

On Mon, 18 Jun 2012 11:52:08 -0700 (PDT), JAgger1
wrote:

I have a set of 20 numbers in cell A1:T1

I'm using =INDEX($A1:$T1,RAND()*COUNTA($A1:$T1)) in cell W1 to Z1 to
randomly select 4 numbers from my set. How would I modify my formula
so as to not get any duplicate's? Thanks


I have done this before using a listbox: fill the listbox with every
possible number, then randomly select an entry in the listbox and use
removeitem to remove it from the listbox so it can't be select twice.
You can get as many entries as the listbox holds in random order with no
possibility of duplicates, and the coding is very easy.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default RAND function without duplicates?

Excellent, thanks
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
Duplicates in Rand Formula [email protected] Excel Discussion (Misc queries) 2 April 6th 07 09:04 AM
HELP with the RAND() Function......AGAIN!!!!! denise1082 via OfficeKB.com Excel Worksheet Functions 9 July 31st 06 12:53 PM
HELP with the RAND() Function!!!!!! denise1082 Excel Worksheet Functions 15 July 31st 06 07:54 AM
Getting RAND() value but NOT its Function?!? Mike Excel Programming 1 February 24th 06 08:56 PM
Rand function Susan Hayes Excel Worksheet Functions 3 August 18th 05 02:20 AM


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

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

About Us

"It's about Microsoft Excel"