LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default difficulty with permutations, please help!

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
permutations art Excel Worksheet Functions 1 May 8th 09 05:07 PM
Permutations Dave Excel Discussion (Misc queries) 5 July 23rd 07 03:06 PM
permutations newyorkjoy Excel Discussion (Misc queries) 3 November 1st 05 08:20 PM
Permutations RedChequer Excel Worksheet Functions 9 September 26th 05 03:14 AM
Permutations RedChequer Excel Worksheet Functions 2 September 25th 05 04:05 AM


All times are GMT +1. The time now is 05:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"