Hopefully, someone can assist me on how to convert a single cell of characters to permute to a range of cells that may change.
In other words, I have very fast code that can create permutations of characters from a single cell, but I am wondering how to make the code more flexible, ie, use multiple columns and rows as the input instead of just a single cell.
The following code is what I have for taking a single cell of character and running the permutations:
What I am looking for is some recursive code that can take a range of data for example A2:G4 & make permutations from the data in that range, not all cells in that range will have data, for example, Row 2 may have 7 entries, row 3 may have 3 entries, row 4 may have only 1 entry.
The display of results should contain the max # of data columns as the number of characters per permutation, so if the max number of characters in one row is 7 then all permutation results should be 7 characters long.
In other words, I have very fast code that can create permutations of characters from a single cell, but I am wondering how to make the code more flexible, ie, use multiple columns and rows as the input instead of just a single cell.
The following code is what I have for taking a single cell of character and running the permutations:
VBA Code:
Sub MakePermutationsFromOneCell()
'
Dim StartTime As Single
StartTime = Timer ' Initialize StartTime
'
Dim ArrayRow As Long
Dim InputStringLength As Long
Dim MaxPermutations As Long
Dim InputString As String, PermutationString As String
Dim ResultsArray() As String
'
InputString = Range("A2").Value2 ' Save string to Permut into InputString
InputStringLength = Len(InputString) ' Save the length of the Permut string into InputStringLength
MaxPermutations = WorksheetFunction.Permut(InputStringLength, InputStringLength) ' Calculate the # of Permutations that will be generated from InputString
PermutationString = "" ' Initialize PermutationString
'
ReDim ResultsArray(1 To MaxPermutations, 1 To 1) ' Set the dimensions of the ResultsArray
'
Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row).ClearContents ' Clear previous permutation results
'
Call GetPermutationsRecursively(PermutationString, InputString, ArrayRow, ResultsArray) ' Get the permutations by passing variables to GetPermutationsRecursively
'
Range("B2").Resize(ArrayRow).Value2 = ResultsArray ' Display the permutation results to the sheet
'
Debug.Print "Script completed in " & Timer - StartTime & " seconds." ' Display the completion time of the script to the 'Immediate' window (CTRL+G) in VBE
MsgBox "Script completed in " & Timer - StartTime & " seconds." ' Display the completion time to a pop up window for the user
End Sub
Sub GetPermutationsRecursively(PermutationString As String, InputString As String, _
ArrayRow As Long, ResultsArray() As String)
'
Dim i As Long, j As Long
'
j = Len(InputString) ' Get the current length of InputString & save to j
'
If j = 1 Then ' If current length of InputString = 1 then ...
ArrayRow = ArrayRow + 1 ' Increment ArrayRow
ResultsArray(ArrayRow, 1) = PermutationString & InputString ' Save this permutation string to ResultsArray
Else ' Else ...
For i = 1 To j ' Loop
Call GetPermutationsRecursively(PermutationString + Mid(InputString, i, 1), _
Left(InputString, i - 1) + Right(InputString, j - i), ArrayRow, _
ResultsArray) '
Next ' Loop back
End If
End Sub
permutations list(1) (version 1).xlsb | ||||
---|---|---|---|---|
A | B | |||
1 | Original string | Permutations | ||
2 | 1234567 | 1234567 | ||
3 | 1234576 | |||
4 | 1234657 | |||
5 | 1234675 | |||
6 | 1234756 | |||
7 | 1234765 | |||
8 | 1235467 | |||
9 | 1235476 | |||
10 | 1235647 | |||
11 | 1235674 | |||
12 | 1235746 | |||
13 | 1235764 | |||
14 | 1236457 | |||
15 | 1236475 | |||
16 | 1236547 | |||
17 | 1236574 | |||
18 | 1236745 | |||
19 | 1236754 | |||
20 | 1237456 | |||
21 | 1237465 | |||
22 | 1237546 | |||
23 | 1237564 | |||
24 | 1237645 | |||
25 | 1237654 | |||
26 | 1243567 | |||
27 | 1243576 | |||
28 | 1243657 | |||
29 | 1243675 | |||
30 | 1243756 | |||
31 | 1243765 | |||
32 | 1245367 | |||
33 | 1245376 | |||
34 | 1245637 | |||
35 | 1245673 | |||
36 | 1245736 | |||
37 | 1245763 | |||
38 | 1246357 | |||
39 | 1246375 | |||
40 | 1246537 | |||
41 | 1246573 | |||
42 | 1246735 | |||
43 | 1246753 | |||
44 | 1247356 | |||
45 | 1247365 | |||
46 | 1247536 | |||
47 | 1247563 | |||
48 | 1247635 | |||
49 | 1247653 | |||
50 | 1253467 | |||
51 | 1253476 | |||
52 | 1253647 | |||
53 | 1253674 | |||
54 | 1253746 | |||
55 | 1253764 | |||
56 | 1254367 | |||
57 | 1254376 | |||
58 | 1254637 | |||
59 | 1254673 | |||
60 | 1254736 | |||
61 | 1254763 | |||
62 | 1256347 | |||
63 | 1256374 | |||
64 | 1256437 | |||
65 | 1256473 | |||
66 | 1256734 | |||
67 | 1256743 | |||
68 | 1257346 | |||
69 | 1257364 | |||
70 | 1257436 | |||
71 | 1257463 | |||
72 | 1257634 | |||
73 | 1257643 | |||
74 | 1263457 | |||
75 | 1263475 | |||
76 | 1263547 | |||
77 | 1263574 | |||
78 | 1263745 | |||
79 | 1263754 | |||
80 | 1264357 | |||
81 | 1264375 | |||
82 | 1264537 | |||
83 | 1264573 | |||
84 | 1264735 | |||
85 | 1264753 | |||
86 | 1265347 | |||
87 | 1265374 | |||
88 | 1265437 | |||
89 | 1265473 | |||
90 | 1265734 | |||
91 | 1265743 | |||
92 | 1267345 | |||
93 | 1267354 | |||
94 | 1267435 | |||
95 | 1267453 | |||
96 | 1267534 | |||
97 | 1267543 | |||
98 | 1273456 | |||
99 | 1273465 | |||
100 | 1273546 | |||
101 | 1273564 | |||
102 | 1273645 | |||
103 | 1273654 | |||
104 | 1274356 | |||
105 | 1274365 | |||
106 | 1274536 | |||
107 | 1274563 | |||
108 | 1274635 | |||
109 | 1274653 | |||
110 | 1275346 | |||
111 | 1275364 | |||
112 | 1275436 | |||
113 | 1275463 | |||
114 | 1275634 | |||
115 | 1275643 | |||
116 | 1276345 | |||
117 | 1276354 | |||
118 | 1276435 | |||
119 | 1276453 | |||
120 | 1276534 | |||
121 | 1276543 | |||
122 | 1324567 | |||
123 | 1324576 | |||
124 | 1324657 | |||
125 | 1324675 | |||
126 | 1324756 | |||
127 | 1324765 | |||
128 | 1325467 | |||
129 | 1325476 | |||
130 | 1325647 | |||
131 | 1325674 | |||
132 | 1325746 | |||
133 | 1325764 | |||
134 | 1326457 | |||
135 | 1326475 | |||
136 | 1326547 | |||
137 | 1326574 | |||
138 | 1326745 | |||
139 | 1326754 | |||
140 | 1327456 | |||
141 | 1327465 | |||
142 | 1327546 | |||
143 | 1327564 | |||
144 | 1327645 | |||
145 | 1327654 | |||
146 | 1342567 | |||
147 | 1342576 | |||
148 | 1342657 | |||
149 | 1342675 | |||
150 | 1342756 | |||
151 | 1342765 | |||
152 | 1345267 | |||
153 | 1345276 | |||
154 | 1345627 | |||
155 | 1345672 | |||
156 | 1345726 | |||
157 | 1345762 | |||
158 | 1346257 | |||
159 | 1346275 | |||
160 | 1346527 | |||
161 | 1346572 | |||
162 | 1346725 | |||
163 | 1346752 | |||
164 | 1347256 | |||
165 | 1347265 | |||
166 | 1347526 | |||
167 | 1347562 | |||
168 | 1347625 | |||
169 | 1347652 | |||
170 | 1352467 | |||
171 | 1352476 | |||
172 | 1352647 | |||
173 | 1352674 | |||
174 | 1352746 | |||
175 | 1352764 | |||
176 | 1354267 | |||
177 | 1354276 | |||
178 | 1354627 | |||
179 | 1354672 | |||
180 | 1354726 | |||
181 | 1354762 | |||
182 | 1356247 | |||
183 | 1356274 | |||
184 | 1356427 | |||
185 | 1356472 | |||
186 | 1356724 | |||
187 | 1356742 | |||
188 | 1357246 | |||
189 | 1357264 | |||
190 | 1357426 | |||
191 | 1357462 | |||
192 | 1357624 | |||
193 | 1357642 | |||
194 | 1362457 | |||
195 | 1362475 | |||
196 | 1362547 | |||
197 | 1362574 | |||
198 | 1362745 | |||
199 | 1362754 | |||
200 | 1364257 | |||
201 | 1364275 | |||
202 | 1364527 | |||
203 | 1364572 | |||
204 | 1364725 | |||
205 | 1364752 | |||
206 | 1365247 | |||
207 | 1365274 | |||
208 | 1365427 | |||
209 | 1365472 | |||
210 | 1365724 | |||
211 | 1365742 | |||
212 | 1367245 | |||
213 | 1367254 | |||
214 | 1367425 | |||
215 | 1367452 | |||
216 | 1367524 | |||
217 | 1367542 | |||
218 | 1372456 | |||
219 | 1372465 | |||
220 | 1372546 | |||
221 | 1372564 | |||
222 | 1372645 | |||
223 | 1372654 | |||
224 | 1374256 | |||
225 | 1374265 | |||
226 | 1374526 | |||
227 | 1374562 | |||
228 | 1374625 | |||
229 | 1374652 | |||
230 | 1375246 | |||
231 | 1375264 | |||
232 | 1375426 | |||
233 | 1375462 | |||
234 | 1375624 | |||
235 | 1375642 | |||
236 | 1376245 | |||
237 | 1376254 | |||
238 | 1376425 | |||
239 | 1376452 | |||
240 | 1376524 | |||
241 | 1376542 | |||
242 | 1423567 | |||
243 | 1423576 | |||
244 | 1423657 | |||
245 | 1423675 | |||
246 | 1423756 | |||
247 | 1423765 | |||
248 | 1425367 | |||
249 | 1425376 | |||
250 | 1425637 | |||
251 | 1425673 | |||
252 | 1425736 | |||
253 | 1425763 | |||
254 | 1426357 | |||
255 | 1426375 | |||
256 | 1426537 | |||
257 | 1426573 | |||
258 | 1426735 | |||
259 | 1426753 | |||
260 | 1427356 | |||
261 | 1427365 | |||
262 | 1427536 | |||
263 | 1427563 | |||
264 | 1427635 | |||
265 | 1427653 | |||
266 | 1432567 | |||
267 | 1432576 | |||
268 | 1432657 | |||
269 | 1432675 | |||
270 | 1432756 | |||
271 | 1432765 | |||
272 | 1435267 | |||
273 | 1435276 | |||
274 | 1435627 | |||
275 | 1435672 | |||
276 | 1435726 | |||
277 | 1435762 | |||
278 | 1436257 | |||
279 | 1436275 | |||
280 | 1436527 | |||
281 | 1436572 | |||
282 | 1436725 | |||
283 | 1436752 | |||
284 | 1437256 | |||
285 | 1437265 | |||
286 | 1437526 | |||
287 | 1437562 | |||
288 | 1437625 | |||
289 | 1437652 | |||
290 | 1452367 | |||
291 | 1452376 | |||
292 | 1452637 | |||
293 | 1452673 | |||
294 | 1452736 | |||
295 | 1452763 | |||
296 | 1453267 | |||
297 | 1453276 | |||
298 | 1453627 | |||
299 | 1453672 | |||
300 | 1453726 | |||
301 | 1453762 | |||
302 | 1456237 | |||
303 | 1456273 | |||
304 | 1456327 | |||
305 | 1456372 | |||
306 | 1456723 | |||
307 | 1456732 | |||
308 | 1457236 | |||
309 | 1457263 | |||
310 | 1457326 | |||
311 | 1457362 | |||
312 | 1457623 | |||
313 | 1457632 | |||
314 | 1462357 | |||
315 | 1462375 | |||
316 | 1462537 | |||
317 | 1462573 | |||
318 | 1462735 | |||
319 | 1462753 | |||
320 | 1463257 | |||
321 | 1463275 | |||
322 | 1463527 | |||
323 | 1463572 | |||
324 | 1463725 | |||
325 | 1463752 | |||
326 | 1465237 | |||
327 | 1465273 | |||
328 | 1465327 | |||
329 | 1465372 | |||
330 | 1465723 | |||
331 | 1465732 | |||
332 | 1467235 | |||
333 | 1467253 | |||
334 | 1467325 | |||
335 | 1467352 | |||
336 | 1467523 | |||
337 | 1467532 | |||
338 | 1472356 | |||
339 | 1472365 | |||
340 | 1472536 | |||
341 | 1472563 | |||
342 | 1472635 | |||
343 | 1472653 | |||
344 | 1473256 | |||
345 | 1473265 | |||
346 | 1473526 | |||
347 | 1473562 | |||
348 | 1473625 | |||
349 | 1473652 | |||
350 | 1475236 | |||
351 | 1475263 | |||
352 | 1475326 | |||
353 | 1475362 | |||
354 | 1475623 | |||
355 | 1475632 | |||
356 | 1476235 | |||
357 | 1476253 | |||
358 | 1476325 | |||
359 | 1476352 | |||
360 | 1476523 | |||
361 | 1476532 | |||
362 | 1523467 | |||
363 | 1523476 | |||
364 | 1523647 | |||
365 | 1523674 | |||
366 | 1523746 | |||
367 | 1523764 | |||
368 | 1524367 | |||
369 | 1524376 | |||
370 | 1524637 | |||
371 | 1524673 | |||
372 | 1524736 | |||
373 | 1524763 | |||
374 | 1526347 | |||
375 | 1526374 | |||
376 | 1526437 | |||
377 | 1526473 | |||
378 | 1526734 | |||
379 | 1526743 | |||
380 | 1527346 | |||
381 | 1527364 | |||
382 | 1527436 | |||
383 | 1527463 | |||
384 | 1527634 | |||
385 | 1527643 | |||
386 | 1532467 | |||
387 | 1532476 | |||
388 | 1532647 | |||
389 | 1532674 | |||
390 | 1532746 | |||
391 | 1532764 | |||
392 | 1534267 | |||
393 | 1534276 | |||
394 | 1534627 | |||
395 | 1534672 | |||
396 | 1534726 | |||
397 | 1534762 | |||
398 | 1536247 | |||
399 | 1536274 | |||
400 | 1536427 | |||
401 | 1536472 | |||
402 | 1536724 | |||
403 | 1536742 | |||
404 | 1537246 | |||
405 | 1537264 | |||
406 | 1537426 | |||
407 | 1537462 | |||
408 | 1537624 | |||
409 | 1537642 | |||
410 | 1542367 | |||
411 | 1542376 | |||
412 | 1542637 | |||
413 | 1542673 | |||
414 | 1542736 | |||
415 | 1542763 | |||
416 | 1543267 | |||
417 | 1543276 | |||
418 | 1543627 | |||
419 | 1543672 | |||
420 | 1543726 | |||
421 | 1543762 | |||
422 | 1546237 | |||
423 | 1546273 | |||
424 | 1546327 | |||
425 | 1546372 | |||
426 | 1546723 | |||
427 | 1546732 | |||
428 | 1547236 | |||
429 | 1547263 | |||
430 | 1547326 | |||
431 | 1547362 | |||
432 | 1547623 | |||
433 | 1547632 | |||
434 | 1562347 | |||
435 | 1562374 | |||
436 | 1562437 | |||
437 | 1562473 | |||
438 | 1562734 | |||
439 | 1562743 | |||
440 | 1563247 | |||
441 | 1563274 | |||
442 | 1563427 | |||
443 | 1563472 | |||
444 | 1563724 | |||
445 | 1563742 | |||
446 | 1564237 | |||
447 | 1564273 | |||
448 | 1564327 | |||
449 | 1564372 | |||
450 | 1564723 | |||
451 | 1564732 | |||
452 | 1567234 | |||
453 | 1567243 | |||
454 | 1567324 | |||
455 | 1567342 | |||
456 | 1567423 | |||
457 | 1567432 | |||
458 | 1572346 | |||
459 | 1572364 | |||
460 | 1572436 | |||
461 | 1572463 | |||
462 | 1572634 | |||
463 | 1572643 | |||
464 | 1573246 | |||
465 | 1573264 | |||
466 | 1573426 | |||
467 | 1573462 | |||
468 | 1573624 | |||
469 | 1573642 | |||
470 | 1574236 | |||
471 | 1574263 | |||
472 | 1574326 | |||
473 | 1574362 | |||
474 | 1574623 | |||
475 | 1574632 | |||
476 | 1576234 | |||
477 | 1576243 | |||
478 | 1576324 | |||
479 | 1576342 | |||
480 | 1576423 | |||
481 | 1576432 | |||
482 | 1623457 | |||
483 | 1623475 | |||
484 | 1623547 | |||
485 | 1623574 | |||
486 | 1623745 | |||
487 | 1623754 | |||
488 | 1624357 | |||
489 | 1624375 | |||
490 | 1624537 | |||
491 | 1624573 | |||
492 | 1624735 | |||
493 | 1624753 | |||
494 | 1625347 | |||
495 | 1625374 | |||
496 | 1625437 | |||
497 | 1625473 | |||
498 | 1625734 | |||
499 | 1625743 | |||
500 | 1627345 | |||
501 | 1627354 | |||
502 | 1627435 | |||
503 | 1627453 | |||
504 | 1627534 | |||
505 | 1627543 | |||
506 | 1632457 | |||
507 | 1632475 | |||
508 | 1632547 | |||
509 | 1632574 | |||
510 | 1632745 | |||
511 | 1632754 | |||
512 | 1634257 | |||
513 | 1634275 | |||
514 | 1634527 | |||
515 | 1634572 | |||
516 | 1634725 | |||
517 | 1634752 | |||
518 | 1635247 | |||
519 | 1635274 | |||
520 | 1635427 | |||
521 | 1635472 | |||
522 | 1635724 | |||
523 | 1635742 | |||
524 | 1637245 | |||
525 | 1637254 | |||
526 | 1637425 | |||
527 | 1637452 | |||
528 | 1637524 | |||
529 | 1637542 | |||
530 | 1642357 | |||
531 | 1642375 | |||
532 | 1642537 | |||
533 | 1642573 | |||
534 | 1642735 | |||
535 | 1642753 | |||
536 | 1643257 | |||
537 | 1643275 | |||
538 | 1643527 | |||
539 | 1643572 | |||
540 | 1643725 | |||
541 | 1643752 | |||
542 | 1645237 | |||
543 | 1645273 | |||
544 | 1645327 | |||
545 | 1645372 | |||
546 | 1645723 | |||
547 | 1645732 | |||
548 | 1647235 | |||
549 | 1647253 | |||
550 | 1647325 | |||
551 | 1647352 | |||
552 | 1647523 | |||
553 | 1647532 | |||
554 | 1652347 | |||
555 | 1652374 | |||
556 | 1652437 | |||
557 | 1652473 | |||
558 | 1652734 | |||
559 | 1652743 | |||
560 | 1653247 | |||
561 | 1653274 | |||
562 | 1653427 | |||
563 | 1653472 | |||
564 | 1653724 | |||
565 | 1653742 | |||
566 | 1654237 | |||
567 | 1654273 | |||
568 | 1654327 | |||
569 | 1654372 | |||
570 | 1654723 | |||
571 | 1654732 | |||
572 | 1657234 | |||
573 | 1657243 | |||
574 | 1657324 | |||
575 | 1657342 | |||
576 | 1657423 | |||
577 | 1657432 | |||
578 | 1672345 | |||
579 | 1672354 | |||
580 | 1672435 | |||
581 | 1672453 | |||
582 | 1672534 | |||
583 | 1672543 | |||
584 | 1673245 | |||
585 | 1673254 | |||
586 | 1673425 | |||
587 | 1673452 | |||
588 | 1673524 | |||
589 | 1673542 | |||
590 | 1674235 | |||
591 | 1674253 | |||
592 | 1674325 | |||
593 | 1674352 | |||
594 | 1674523 | |||
595 | 1674532 | |||
596 | 1675234 | |||
597 | 1675243 | |||
598 | 1675324 | |||
599 | 1675342 | |||
600 | 1675423 | |||
601 | 1675432 | |||
602 | 1723456 | |||
603 | 1723465 | |||
604 | 1723546 | |||
605 | 1723564 | |||
606 | 1723645 | |||
607 | 1723654 | |||
608 | 1724356 | |||
609 | 1724365 | |||
610 | 1724536 | |||
611 | 1724563 | |||
612 | 1724635 | |||
613 | 1724653 | |||
614 | 1725346 | |||
615 | 1725364 | |||
616 | 1725436 | |||
617 | 1725463 | |||
618 | 1725634 | |||
619 | 1725643 | |||
620 | 1726345 | |||
621 | 1726354 | |||
622 | 1726435 | |||
623 | 1726453 | |||
624 | 1726534 | |||
625 | 1726543 | |||
626 | 1732456 | |||
627 | 1732465 | |||
628 | 1732546 | |||
629 | 1732564 | |||
630 | 1732645 | |||
631 | 1732654 | |||
632 | 1734256 | |||
633 | 1734265 | |||
634 | 1734526 | |||
635 | 1734562 | |||
636 | 1734625 | |||
637 | 1734652 | |||
638 | 1735246 | |||
639 | 1735264 | |||
640 | 1735426 | |||
641 | 1735462 | |||
642 | 1735624 | |||
643 | 1735642 | |||
644 | 1736245 | |||
645 | 1736254 | |||
646 | 1736425 | |||
647 | 1736452 | |||
648 | 1736524 | |||
649 | 1736542 | |||
650 | 1742356 | |||
651 | 1742365 | |||
652 | 1742536 | |||
653 | 1742563 | |||
654 | 1742635 | |||
655 | 1742653 | |||
656 | 1743256 | |||
657 | 1743265 | |||
658 | 1743526 | |||
659 | 1743562 | |||
660 | 1743625 | |||
661 | 1743652 | |||
662 | 1745236 | |||
663 | 1745263 | |||
664 | 1745326 | |||
665 | 1745362 | |||
666 | 1745623 | |||
667 | 1745632 | |||
668 | 1746235 | |||
669 | 1746253 | |||
670 | 1746325 | |||
671 | 1746352 | |||
672 | 1746523 | |||
673 | 1746532 | |||
674 | 1752346 | |||
675 | 1752364 | |||
676 | 1752436 | |||
677 | 1752463 | |||
678 | 1752634 | |||
679 | 1752643 | |||
680 | 1753246 | |||
681 | 1753264 | |||
682 | 1753426 | |||
683 | 1753462 | |||
684 | 1753624 | |||
685 | 1753642 | |||
686 | 1754236 | |||
687 | 1754263 | |||
688 | 1754326 | |||
689 | 1754362 | |||
690 | 1754623 | |||
691 | 1754632 | |||
692 | 1756234 | |||
693 | 1756243 | |||
694 | 1756324 | |||
695 | 1756342 | |||
696 | 1756423 | |||
697 | 1756432 | |||
698 | 1762345 | |||
699 | 1762354 | |||
700 | 1762435 | |||
701 | 1762453 | |||
702 | 1762534 | |||
703 | 1762543 | |||
704 | 1763245 | |||
705 | 1763254 | |||
706 | 1763425 | |||
707 | 1763452 | |||
708 | 1763524 | |||
709 | 1763542 | |||
710 | 1764235 | |||
711 | 1764253 | |||
712 | 1764325 | |||
713 | 1764352 | |||
714 | 1764523 | |||
715 | 1764532 | |||
716 | 1765234 | |||
717 | 1765243 | |||
718 | 1765324 | |||
719 | 1765342 | |||
720 | 1765423 | |||
721 | 1765432 | |||
722 | 2134567 | |||
723 | 2134576 | |||
724 | 2134657 | |||
725 | 2134675 | |||
726 | 2134756 | |||
727 | 2134765 | |||
728 | 2135467 | |||
729 | 2135476 | |||
730 | 2135647 | |||
731 | 2135674 | |||
732 | 2135746 | |||
733 | 2135764 | |||
734 | 2136457 | |||
735 | 2136475 | |||
736 | 2136547 | |||
737 | 2136574 | |||
738 | 2136745 | |||
739 | 2136754 | |||
740 | 2137456 | |||
741 | 2137465 | |||
742 | 2137546 | |||
743 | 2137564 | |||
744 | 2137645 | |||
745 | 2137654 | |||
746 | 2143567 | |||
747 | 2143576 | |||
748 | 2143657 | |||
749 | 2143675 | |||
750 | 2143756 | |||
751 | 2143765 | |||
752 | 2145367 | |||
753 | 2145376 | |||
754 | 2145637 | |||
755 | 2145673 | |||
756 | 2145736 | |||
757 | 2145763 | |||
758 | 2146357 | |||
759 | 2146375 | |||
760 | 2146537 | |||
761 | 2146573 | |||
762 | 2146735 | |||
763 | 2146753 | |||
764 | 2147356 | |||
765 | 2147365 | |||
766 | 2147536 | |||
767 | 2147563 | |||
768 | 2147635 | |||
769 | 2147653 | |||
770 | 2153467 | |||
771 | 2153476 | |||
772 | 2153647 | |||
773 | 2153674 | |||
774 | 2153746 | |||
775 | 2153764 | |||
776 | 2154367 | |||
777 | 2154376 | |||
778 | 2154637 | |||
779 | 2154673 | |||
780 | 2154736 | |||
781 | 2154763 | |||
782 | 2156347 | |||
783 | 2156374 | |||
784 | 2156437 | |||
785 | 2156473 | |||
786 | 2156734 | |||
787 | 2156743 | |||
788 | 2157346 | |||
789 | 2157364 | |||
790 | 2157436 | |||
791 | 2157463 | |||
792 | 2157634 | |||
793 | 2157643 | |||
794 | 2163457 | |||
795 | 2163475 | |||
796 | 2163547 | |||
797 | 2163574 | |||
798 | 2163745 | |||
799 | 2163754 | |||
800 | 2164357 | |||
801 | 2164375 | |||
802 | 2164537 | |||
803 | 2164573 | |||
804 | 2164735 | |||
805 | 2164753 | |||
806 | 2165347 | |||
807 | 2165374 | |||
808 | 2165437 | |||
809 | 2165473 | |||
810 | 2165734 | |||
811 | 2165743 | |||
812 | 2167345 | |||
813 | 2167354 | |||
814 | 2167435 | |||
815 | 2167453 | |||
816 | 2167534 | |||
817 | 2167543 | |||
818 | 2173456 | |||
819 | 2173465 | |||
820 | 2173546 | |||
821 | 2173564 | |||
822 | 2173645 | |||
823 | 2173654 | |||
824 | 2174356 | |||
825 | 2174365 | |||
826 | 2174536 | |||
827 | 2174563 | |||
828 | 2174635 | |||
829 | 2174653 | |||
830 | 2175346 | |||
831 | 2175364 | |||
832 | 2175436 | |||
833 | 2175463 | |||
834 | 2175634 | |||
835 | 2175643 | |||
836 | 2176345 | |||
837 | 2176354 | |||
838 | 2176435 | |||
839 | 2176453 | |||
840 | 2176534 | |||
841 | 2176543 | |||
842 | 2314567 | |||
843 | 2314576 | |||
844 | 2314657 | |||
845 | 2314675 | |||
846 | 2314756 | |||
847 | 2314765 | |||
848 | 2315467 | |||
849 | 2315476 | |||
850 | 2315647 | |||
851 | 2315674 | |||
852 | 2315746 | |||
853 | 2315764 | |||
854 | 2316457 | |||
855 | 2316475 | |||
856 | 2316547 | |||
857 | 2316574 | |||
858 | 2316745 | |||
859 | 2316754 | |||
860 | 2317456 | |||
861 | 2317465 | |||
862 | 2317546 | |||
863 | 2317564 | |||
864 | 2317645 | |||
865 | 2317654 | |||
866 | 2341567 | |||
867 | 2341576 | |||
868 | 2341657 | |||
869 | 2341675 | |||
870 | 2341756 | |||
871 | 2341765 | |||
872 | 2345167 | |||
873 | 2345176 | |||
874 | 2345617 | |||
875 | 2345671 | |||
876 | 2345716 | |||
877 | 2345761 | |||
878 | 2346157 | |||
879 | 2346175 | |||
880 | 2346517 | |||
881 | 2346571 | |||
882 | 2346715 | |||
883 | 2346751 | |||
884 | 2347156 | |||
885 | 2347165 | |||
886 | 2347516 | |||
887 | 2347561 | |||
888 | 2347615 | |||
889 | 2347651 | |||
890 | 2351467 | |||
891 | 2351476 | |||
892 | 2351647 | |||
893 | 2351674 | |||
894 | 2351746 | |||
895 | 2351764 | |||
896 | 2354167 | |||
897 | 2354176 | |||
898 | 2354617 | |||
899 | 2354671 | |||
900 | 2354716 | |||
901 | 2354761 | |||
902 | 2356147 | |||
903 | 2356174 | |||
904 | 2356417 | |||
905 | 2356471 | |||
906 | 2356714 | |||
907 | 2356741 | |||
908 | 2357146 | |||
909 | 2357164 | |||
910 | 2357416 | |||
911 | 2357461 | |||
912 | 2357614 | |||
913 | 2357641 | |||
914 | 2361457 | |||
915 | 2361475 | |||
916 | 2361547 | |||
917 | 2361574 | |||
918 | 2361745 | |||
919 | 2361754 | |||
920 | 2364157 | |||
921 | 2364175 | |||
922 | 2364517 | |||
923 | 2364571 | |||
924 | 2364715 | |||
925 | 2364751 | |||
926 | 2365147 | |||
927 | 2365174 | |||
928 | 2365417 | |||
929 | 2365471 | |||
930 | 2365714 | |||
931 | 2365741 | |||
932 | 2367145 | |||
933 | 2367154 | |||
934 | 2367415 | |||
935 | 2367451 | |||
936 | 2367514 | |||
937 | 2367541 | |||
938 | 2371456 | |||
939 | 2371465 | |||
940 | 2371546 | |||
941 | 2371564 | |||
942 | 2371645 | |||
943 | 2371654 | |||
944 | 2374156 | |||
945 | 2374165 | |||
946 | 2374516 | |||
947 | 2374561 | |||
948 | 2374615 | |||
949 | 2374651 | |||
950 | 2375146 | |||
951 | 2375164 | |||
952 | 2375416 | |||
953 | 2375461 | |||
954 | 2375614 | |||
955 | 2375641 | |||
956 | 2376145 | |||
957 | 2376154 | |||
958 | 2376415 | |||
959 | 2376451 | |||
960 | 2376514 | |||
961 | 2376541 | |||
962 | 2413567 | |||
963 | 2413576 | |||
964 | 2413657 | |||
965 | 2413675 | |||
966 | 2413756 | |||
967 | 2413765 | |||
968 | 2415367 | |||
969 | 2415376 | |||
970 | 2415637 | |||
971 | 2415673 | |||
972 | 2415736 | |||
973 | 2415763 | |||
974 | 2416357 | |||
975 | 2416375 | |||
976 | 2416537 | |||
977 | 2416573 | |||
978 | 2416735 | |||
979 | 2416753 | |||
980 | 2417356 | |||
981 | 2417365 | |||
982 | 2417536 | |||
983 | 2417563 | |||
984 | 2417635 | |||
985 | 2417653 | |||
986 | 2431567 | |||
987 | 2431576 | |||
988 | 2431657 | |||
989 | 2431675 | |||
990 | 2431756 | |||
991 | 2431765 | |||
992 | 2435167 | |||
993 | 2435176 | |||
994 | 2435617 | |||
995 | 2435671 | |||
996 | 2435716 | |||
997 | 2435761 | |||
998 | 2436157 | |||
999 | 2436175 | |||
1000 | 2436517 | |||
1001 | 2436571 | |||
Sheet2 |
What I am looking for is some recursive code that can take a range of data for example A2:G4 & make permutations from the data in that range, not all cells in that range will have data, for example, Row 2 may have 7 entries, row 3 may have 3 entries, row 4 may have only 1 entry.
The display of results should contain the max # of data columns as the number of characters per permutation, so if the max number of characters in one row is 7 then all permutation results should be 7 characters long.
permutations list(1) (version 1).xlsb | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | |||
1 | ||||||||||
2 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |||
3 | 1 | 2 | 3 | |||||||
4 | 5 | 6 | ||||||||
5 | ||||||||||
Sheet4 |
Last edited: