View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
barnabel barnabel is offline
external usenet poster
 
Posts: 119
Default creating lists of permutations

Here is a little macro that may help you. you can set which column has the
names in it and which column to put the reult in. Don't make them the same

Peter Richardson
Sub leagueMatch()
Dim i, j As Long
Dim datacolumn As String
Dim resultColumn As String
Dim firstRow, lastRow, currRow As Long

datacolumn = "A"
resultColumn = "B"
firstRow = 1
currRow = 1
lastRow = Range(datacolumn & Rows.Count).End(xlUp).Row

For i = firstRow To lastRow - 1
For j = i + 1 To lastRow
Range(resultColumn & Format(currRow)) = Range(datacolumn &
Format(i)) & " vs " & Range(datacolumn & Format(j))
currRow = currRow + 1
Next
Next
End Sub


"jake" wrote:

I have a list of all the football teams in a league, like so:

Dundee United
Partick Thistle
Queen of the South

etc.

I need to generate a list of fixtures for the coming football season, like so:

Dundee United Partick Thistle
Dundee United Queen of the South
Partick Thistle Quen of the South

etc.

Any ideas how to do this without manually manipulating huge amounts of data
(sometimes I have to do this with HUGE lists and it becomes very time
consuming)

Cheers,

Jake