![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Sydney/Brisbane , Australia
Posts: 539
|
A lady at work is running a sweep on a trifecta in Austalias biggest horse race.
There are 24 horses in the race.. and the prize is $5000. she is printing the tickets on normal paper and i'm worried about fraud. We are printing out 1 of every possible combination, and selling every ticket. There are 12000+ combinations so hence 12,000+ tickets. I want to keep a register of the ticket number... and its relative combination. How can i create a list of each possible combination? She is about to manually write all the tickets up. I'm hoping to get VBA to print the tickets for her (with the combinations, and the registration number) [ This Message was edited by: Qroozn on 2002-05-20 20:57 ] |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
I don't know anything about horse racing so I don't know how many horses are involved in each combination. If you could say how many horses would be involved in each ticket maybe I could help
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: North Alabama, USA
Posts: 105
|
Hi Q,
Well if you are going to print all 13,824 anyway buy same bright colored die cut sticker circles (I hope you have a fast laser printer) Priint one number and a nice graphic logo of you own design. If you get a good bright florecent it will drive color copiers nuts. We do inventory "dots" like this all the time. The one we use are about 8 accross and 10 down or 80 to the page. Should take less than 10 minutes.
__________________
Hope this helps! Rocky <h6>"Be not the first by whom the New are try'd, Nor yet the last to lay the Old aside." Alexander Pope (1688-1744).</h6> |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Sydney/Brisbane , Australia
Posts: 539
|
Thanks guys.
Well there are 24 horses in the race. so that means the number of combinations is 24 x 23 x 22 = 12,144 possible combos. 1st thing first. how can i do script to put A B C 1 1 2 3 2 1 2 4 3 1 2 5 etc up to 12144 24 23 22 |
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
If: A1 has "1st place" B1 has "2nd place" C1 has "3rd place" Run the following Code:
Sub test()
Dim x As Integer, y As Integer, z As Integer, a As Long
Dim MyArray, Counter As Long
a = WorksheetFunction.Permut(24, 3)
ReDim MyArray(1 To a, 1 To 3)
For x = 1 To 24
For y = 1 To 24
For z = 1 To 24
If x <> y And x <> z And y <> z Then
Counter = Counter + 1
MyArray(Counter, 1) = x
MyArray(Counter, 2) = y
MyArray(Counter, 3) = z
End If
Next z
Next y
Next x
Range("A2").Resize(a, 3) = MyArray
End Sub
Jay |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|