Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
scottwilsonx
 
Posts: n/a
Default RANDBETWEEN query


Hi everyone, hope someone can help.
I have a list of 16 names, numbered 1 to 16 in the range: A1 to B17
where column A has the names, and column B the sequence from 1 to 16.

I have a cell with the formula: RANDBETWEEN(1,16) which gives you a
number between 1 and 16 each time you press F9 to recalculate.

However, I would like to change the formulae so that if you recalculate
and get the number 6 (for example), you won't get 6 again until the
other 15 numbers have also been shown.

Is this possible using a function or VBA ?

Many thanks for your help!


--
scottwilsonx
------------------------------------------------------------------------
scottwilsonx's Profile: http://www.excelforum.com/member.php...o&userid=11128
View this thread: http://www.excelforum.com/showthread...hreadid=274544

  #2   Report Post  
Frank Kabel
 
Posts: n/a
Default

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

--
Regards
Frank Kabel
Frankfurt, Germany

"scottwilsonx" schrieb im
Newsbeitrag ...

Hi everyone, hope someone can help.
I have a list of 16 names, numbered 1 to 16 in the range: A1 to B17
where column A has the names, and column B the sequence from 1 to 16.

I have a cell with the formula: RANDBETWEEN(1,16) which gives you a
number between 1 and 16 each time you press F9 to recalculate.

However, I would like to change the formulae so that if you

recalculate
and get the number 6 (for example), you won't get 6 again until the
other 15 numbers have also been shown.

Is this possible using a function or VBA ?

Many thanks for your help!


--
scottwilsonx
---------------------------------------------------------------------

---
scottwilsonx's Profile:

http://www.excelforum.com/member.php...o&userid=11128
View this thread:

http://www.excelforum.com/showthread...hreadid=274544


  #3   Report Post  
hgrove
 
Posts: n/a
Default


Frank Kabel wrote...
see:
http://www.mcgimpsey.com/excel/udfs/randint.html

...

Incomplete answer. Randint could provide a shuffled array of numbers
from 1 to 16, but to sample from it cyclically would require another
UDF like

Function cycrnd() As Long
Static a As Variant, n As Long

Application.Volatile 'necessary for this

If IsEmpty(a) Then
a = randint(1, 16)
n = LBound(a)

Else
If n < UBound(a) Then n = n + 1 Else n = LBound(a)

End If

cycrnd = a(n)

End Function


--
hgrove
------------------------------------------------------------------------
hgrove's Profile: http://www.excelforum.com/member.php...o&userid=11432
View this thread: http://www.excelforum.com/showthread...hreadid=274544

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
Query of External Data Excel GuRu Excel Discussion (Misc queries) 2 January 3rd 05 07:43 PM
saving wkbk minus MS Query links Bill_S Excel Discussion (Misc queries) 1 January 3rd 05 06:00 PM
Pivot Tables referring to external data query Excel GuRu Excel Discussion (Misc queries) 4 December 29th 04 06:29 PM
New web query with Excel Pro Edition 2003 Chandler Links and Linking in Excel 2 December 15th 04 06:03 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


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