Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This would be a start. You can continue the pattern (and implement
utilizing additional sheets): [ it does look like it is 53^n for the way you are doing it]. Sub AA() 'for n = 2 Application.Calculation = xlCalculationManual a = 54 b = 1 For i = 2 To 54 For j = 2 To 54 a = a + 1 If a 65536 Then a = 2 b = b + 12 Cells(1, b).Resize(1, 11).Value = _ Cells(1, 1).Resize(1, 11).Value End If Cells(a, b) = 2 Cells(a, b + 1).Resize(1, 10).Formula = "=B" & i & "+B" & j Next j Next i ' for n = 3 For i = 2 To 54 For j = 2 To 54 For k = 2 To 54 a = a + 1 If a 65536 Then a = 2 b = b + 12 If b + 10 256 Then GoTo Cleanup Cells(1, b).Resize(1, 11).Value = _ Cells(1, 1).Resize(1, 11).Value End If Cells(a, b) = 3 Cells(a, b + 1).Resize(1, 10).Formula = "=B" & i & _ "+B" & j & "+B" & k Next k Next j Next i ' for n = 4 For i = 2 To 54 For j = 2 To 54 For k = 2 To 54 For l = 2 To 54 a = a + 1 If a 65536 Then a = 2 b = b + 12 If b + 11 256 Then GoTo Cleanup Cells(1, b).Resize(1, 11).Value = _ Cells(1, 1).Resize(1, 11).Value End If Cells(a, b) = 3 Cells(a, b + 1).Resize(1, 10).Formula = "=B" & i & _ "+B" & j & "+B" & k & "+B" & l Next l Next k Next j Next i Cleanup: Application.Calculation = xlCalculationAutomatic End Sub -- Regards, Tom Ogilvy "Loane Sharp" wrote in message ... Hi Tom Thank you very much for your reply. You say you want to generate them, so where do you want to put the output Am I right in saying that I'm going to run into problems, either way: ultimately memory problems (if I write many of these permutations to an array) or more rapidly the 65,536 row limit (if I write the permutations to a worksheet)? I'm thinking of storing the values to an array and then, row-by-row or in batches, transferring them to a SQL Server table using ADO. (It took me forever to crack the ADO nut, so I'm keen to get good use out of it anyway!) Probably writing the permutations to an array will deliver the best performance. and in what format? I would like the SQL Server table to have 12 columns: the first column should indicate "n" (1, 2, 3, ... ~ as 53^n) and the 2nd through 12th columns should indicate the pattern of use in each of the 11 time slots ("t1", "t2", ..., "t11" ~ as "0", "1", "1", ...). I have attached an Excel spreadsheet to show the format I've been trying to work with (is that allowed?), hopefully you will receive it. (I used WinRAR for maximum compression, but if you have problems extracting this I can send a regular WinZip file). Best regards Loane |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
permutations | Excel Worksheet Functions | |||
Permutations | Excel Discussion (Misc queries) | |||
permutations | Excel Discussion (Misc queries) | |||
Permutations | Excel Worksheet Functions | |||
Permutations | Excel Worksheet Functions |