ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Exotic Bets Spreadsheet - Need Help! (https://www.excelbanter.com/excel-discussion-misc-queries/26872-exotic-bets-spreadsheet-need-help.html)

Kevin

Exotic Bets Spreadsheet - Need Help!
 
Hi, I want to load the 14 horses in the Preakness into Excel. And then
have excel kick out all possible combinations for 1-2-3 place and
1-2-3-4. I can't seem to find an easy way to do this that is not
manual. Please advise - thanks! Here is the list:

1 Malibu Moonshine
2 High Fly
3 Noble Causeway
4 Greeley's Galaxy
5 Scrappy T
6 Hal's Image
7 Closing Argument
8 Galloping Grocer
9 Wilko
10 Sun King
11 High Limit
12 Afleet Alex
13 Giacomo
14 Going Wild


Jason Morin

The macro below give you all possible 1-2-3 combinations (2184 in all)
starting in D1. Assuming horse names are in A1:A14:

Sub Combos()
Dim rng As Range
Dim ws As Worksheet
Set ws = ActiveSheet
Set rng = ActiveSheet.[A1:A14]
n = 0
For i = 1 To 14
For j = 1 To 14
For k = 1 To 14
If i < j And j < k And i < k Then
n = n + 1
ws.Cells(n, "D") = "1) " & rng(i) & _
" 2) " & rng(j) & _
" 3) " & rng(k)
End If
Next k: Next j: Next i
End Sub

---
Based on a piece of code from Tom Ogilvy for creating combos.

HTH
Jason
Atlanta, GA


"Kevin" wrote:

Hi, I want to load the 14 horses in the Preakness into Excel. And then
have excel kick out all possible combinations for 1-2-3 place and
1-2-3-4. I can't seem to find an easy way to do this that is not
manual. Please advise - thanks! Here is the list:

1 Malibu Moonshine
2 High Fly
3 Noble Causeway
4 Greeley's Galaxy
5 Scrappy T
6 Hal's Image
7 Closing Argument
8 Galloping Grocer
9 Wilko
10 Sun King
11 High Limit
12 Afleet Alex
13 Giacomo
14 Going Wild



bj

copy the names into columns A,B,C
copy A1:C14
and paste into A1:C196 (14 squared)
sort column B only
copy A1:C196
paste into A1:C2744 (14 cubed)
Sort Column A only
Copy A1:C2744 and paste on Sheet 2 (Will use this to generate the first
four places)
goback to sheet 1
in D1 enter
=if(or(A1=B1,A1=C1,B1=C1),1,0)
Copy D1 and paste to D1:D2744
Use filter or sort to gather all of the Column D "1" values together and
delete these rows.
Sheet one now has all of the 1,2,3 possibilities
go to sheet 2.
Copy C1:C2744 and paste to D1:D2744
copy A1:D2744 and paste to A1:D38416
Sort Column C only
in E1 enter
=if(or(A1=B1,A1=C1,A1=D1,B1=C1,B1=D1,C1=D1),1,0)
cand copy down to E38416
Again sort, or filter, to gather all of the "1"s together and delete these
rows

"Kevin" wrote:

Hi, I want to load the 14 horses in the Preakness into Excel. And then
have excel kick out all possible combinations for 1-2-3 place and
1-2-3-4. I can't seem to find an easy way to do this that is not
manual. Please advise - thanks! Here is the list:

1 Malibu Moonshine
2 High Fly
3 Noble Causeway
4 Greeley's Galaxy
5 Scrappy T
6 Hal's Image
7 Closing Argument
8 Galloping Grocer
9 Wilko
10 Sun King
11 High Limit
12 Afleet Alex
13 Giacomo
14 Going Wild




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com