LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default RANDBETWEEN()

"B. R.Ramachandran" wrote:
Every time you hit F9 button, you will have a new set of non-repeating
random numbers between 1 and15 in A2-A6.


.... And every time you edit any cell in the workbook :-(.

Presumably that's okay with Paul, since the same is true about RANDBETWEEN.

But one way to avoid that "volatile" behavior is to replace =RAND() with
=myRand(), which is a UDF defined as follows:

Function myRand(Optional arg as Range) as Double
Static first as Integer
If first = 0 Then Randomize: first = 1
myRand = Rnd()
End Function

If you pass a cell or cell range to myRand, it will recalculate whenever any
cell in the range is edited. Otherwise, myRand is recalculated only when
the worksheet is recalculated, e.g. ctrl+alt+F9.


----- original message -----

"B. R.Ramachandran" wrote in
message ...
Hi,

In a helper column, say B1 to B15, enter the formula =RAND(). This will
create 15 random numbers.

Now, in A2, enter the formula, =RANK(B1,$B$1:$B$15,1)
and drag (autofill) the formula down to A6.

Every time you hit F9 button, you will have a new set of non-repeating
random numbers between 1 and15 in A2-A6.

Regards,
B. R. Ramachandran




"Paul" wrote:

I'm using the formula =RANDBETWEEN(1,15)
to generate random numbers in cells A2 through A6.
I don't want any of those random numbers to be repeated.
Any suggestions on how to do this?
Thanks for your help.


 
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
RANDBETWEEN Jerm Excel Worksheet Functions 15 September 7th 09 02:27 PM
Randbetween Steve Moss Excel Discussion (Misc queries) 1 July 30th 07 09:50 AM
randbetween(1.1,1.25) Deniz Excel Worksheet Functions 3 July 10th 07 04:40 PM
RANDBETWEEN pkeegs Excel Worksheet Functions 6 April 27th 07 01:12 AM
randbetween [email protected] Excel Discussion (Misc queries) 1 November 21st 05 01:25 PM


All times are GMT +1. The time now is 01:32 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"