View Single Post
  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

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