Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how do I create a random list whilst keeping some entries fromrandomizing?

I need to create a large number of randomly sorted lists from a single master list (random team order per event based on a list of teams entered for all events). Some of the entries must remain in the same order in each list, but the remaining entries must be shuffled.

ie. Teams are A, B, C, D, E, F, G, H, J, K and L . CD and HJK must always appear in the same order. Therefore B.CD.ME.HJK.FAGL, AF.HJK.GMLEB.CD, HJK.FL.CD.EBAGM etc are all valid solutions.

I can create a fully random list easily, but can't find an easy way to keep the important entries in the same order.

Cheers
Waz.


Submitted via EggHeadCafe - Software Developer Portal of Choice
Look Ma, No DataBase! Bamboo Prevalence
http://www.eggheadcafe.com/tutorials...abase-bam.aspx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default how do I create a random list whilst keeping some entries from randomizing?

Hi,

Try this :

'--------------------------------------
Sub test()
Dim Dic As Object, Arr()
Arr = Array("A", "B", "C", "D", "E", _
"F", "G", "H", "J", "K", "L")

Set Dic = CreateObject("Scripting.Dictionary")
Do
Randomize
v = Arr(Int(Int(UBound(Arr) - LBound(Arr) + 1) _
* Rnd + LBound(Arr)))
If Not Dic.Exists(v) Then
Select Case UCase(v)
Case Is = "C", "D"
Dic.Add "C", "C"
Dic.Add "D", "D"
i = i + 2
Case Is = "H", "J", "K"
Dic.Add "H", "H"
Dic.Add "J", "J"
Dic.Add "K", "K"
i = i + 3
Case Else
Dic.Add v, v
i = i + 1
End Select
End If
Loop Until i = UBound(Arr)

With Worksheets("Sheet1")
.Range("A1").Resize(i) = Application.Transpose(Dic.items)
End With
'--------------------------------------



"warren dwyer" a écrit dans le message de groupe de discussion :
...
I need to create a large number of randomly sorted lists from a single master list (random
team order per event based on a list of teams entered for all events). Some of the entries
must remain in the same order in each list, but the remaining entries must be shuffled.

ie. Teams are A, B, C, D, E, F, G, H, J, K and L . CD and HJK must always appear in the
same order. Therefore B.CD.ME.HJK.FAGL, AF.HJK.GMLEB.CD, HJK.FL.CD.EBAGM etc are all
valid solutions.

I can create a fully random list easily, but can't find an easy way to keep the important
entries in the same order.

Cheers
Waz.


Submitted via EggHeadCafe - Software Developer Portal of Choice
Look Ma, No DataBase! Bamboo Prevalence
http://www.eggheadcafe.com/tutorials...abase-bam.aspx

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how do I create a random list whilst keeping some entries fromrandomizing?


Assign the items the same random number in the 1st field and then use a
second field for the order 1,2,3,.... Then sort on the two fields.
Items that are singular just keep the 2nd field empty.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=168766

Microsoft Office Help

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
How to applying a ratio (whilst keeping total the same!) kippers Excel Worksheet Functions 2 March 3rd 09 08:26 AM
Concatenate whilst keeping formatting DJ Excel Discussion (Misc queries) 2 December 22nd 08 12:21 PM
how to identify unique list of 200 random entries from a list of 3 tjb Excel Worksheet Functions 3 August 13th 07 02:15 PM
Keeping Chart Series Formats whilst sorting Fullam Charts and Charting in Excel 0 May 3rd 06 11:35 AM
Right Filling A Formula Whilst Keeping A Static Column kevtherev Excel Discussion (Misc queries) 4 September 29th 05 10:18 PM


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