Combin copy total 78 sets

Kishan

Well-known Member
Joined
Mar 15, 2011
Messages
1,648
Office Version
  1. 2010
Platform
  1. Windows
Using Excel 2000

Hi,

I got my data in the range A6:AX18 there are 13 lines “row6 to row18” 24 columns “A to AX”

I want to make copies of 13 rows of 2 lines sets using =COMBIN(13,2) = means total 78 combinations like copy line1&2, 1&3, 1&4, 1&5, 1&6 so on up to 78 combinations.

Copy start from row 25 and after each set need one blank space in-between.

Here is the example of copy starting 3 sets. line1&2, 1&3, 1&4,

NX.xls
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAX
1
2
3
4Serial NumbersEM123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
5Serial NumbersEM123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
61N.X1N.XN.X1N.XN.XN.XN.X1N.XN.XN.XN.XN.XN.XN.XN.XN.X1234567891011121314151617181920212223242526272829
72N.XN.XN.XN.X12N.XN.XN.XN.XN.XN.XN.XN.X1N.X1N.XN.X1234567891011121314151617181920212223242526272829
83N.XN.XN.XN.X123N.XN.XN.XN.X1N.XN.X123N.X123456789101112131415161718192021222324252627282930
94N.XN.XN.XN.XN.X12N.X1N.XN.X123456N.X123456789101112131415161718192021222324252627282930
105N.XN.XN.XN.X1N.X1N.X1N.XN.XN.X1234N.XN.XN.X1234567891011121314151617181920212223242526272829
1161N.XN.X12N.X1N.XN.XN.X123N.X1N.XN.XN.XN.X1234567891011121314151617181920212223242526272829
1271N.XN.X1N.XN.XN.X1N.XN.X12N.XN.X1N.XN.X1N.X1234567891011121314151617181920212223242526272829
1381N.XN.XN.XN.XN.XN.X1N.X1N.X1N.XN.XN.XN.XN.X12345678910111213141516171819202122232425262728293031
149N.X1N.XN.X1N.XN.XN.XN.X123N.X1N.XN.XN.X12345678910111213141516171819202122232425262728293031
151012N.X12N.XN.XN.XN.X12N.XN.X123N.X1N.X1234567891011121314151617181920212223242526272829
161112N.X123N.XN.XN.XN.XN.XN.X1N.X123N.XN.X1234567891011121314151617181920212223242526272829
171212N.XN.X12N.X1N.XN.X123N.X123N.X123456789101112131415161718192021222324252627282930
181312N.XN.X12N.X12345678910N.X123456789101112131415161718192021222324252627282930
19
20
21
22
23
24Serial NumbersEM123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
251N.X1N.XN.X1N.XN.XN.XN.X1N.XN.XN.XN.XN.XN.XN.XN.XN.X1234567891011121314151617181920212223242526272829
262N.XN.XN.XN.X12N.XN.XN.XN.XN.XN.XN.XN.X1N.X1N.XN.X1234567891011121314151617181920212223242526272829
27
281N.X1N.XN.X1N.XN.XN.XN.X1N.XN.XN.XN.XN.XN.XN.XN.XN.X1234567891011121314151617181920212223242526272829
293N.XN.XN.XN.X123N.XN.XN.XN.X1N.XN.X123N.X123456789101112131415161718192021222324252627282930
30
311N.X1N.XN.X1N.XN.XN.XN.X1N.XN.XN.XN.XN.XN.XN.XN.XN.X1234567891011121314151617181920212223242526272829
324N.XN.XN.XN.XN.X12N.X1N.XN.X123456N.X123456789101112131415161718192021222324252627282930
Hoja1


Here is a total 78 COMBIN

NX.xls
ABCD
1
2
3
4NumbersPick
5132
612
713
814
915
1016
1117
1218
1319
14110
15111
16112
17113
1823
1924
2025
2126
2227
2328
2429
25210
26211
27212
28213
2934
3035
3136
3237
3338
3439
35310
36311
37312
38313
3945
4046
4147
4248
4349
44410
45411
46412
47413
4856
4957
5058
5159
52510
53511
54512
55513
5667
5768
5869
59610
60611
61612
62613
6378
6479
65710
66711
67712
68713
6989
70810
71811
72812
73813
74910
75911
76912
77913
781011
791012
801013
811112
821113
831213
COMBIN


Thank you in advance

Regards,
Kishan
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hello @Kishan, thanks for posting on MrExcel.

Try this macro:

VBA Code:
Sub combin_13_2()
  Dim a As Variant, b As Variant
  Dim i As Long, j As Long, k As Long, m As Long, n As Long
  
  a = Range("A6:AX18").Value
  n = WorksheetFunction.Combin(13, 2) * 3
  ReDim b(1 To n, 1 To UBound(a, 2))
  
  For i = 1 To UBound(a, 1)
    For j = i + 1 To UBound(a, 1)
      m = m + 1
      For k = 1 To UBound(a, 2)
        b(m, k) = a(i, k)
        b(m + 1, k) = a(j, k)
      Next
      m = m + 2
    Next
  Next
  
  Range("A25").Resize(UBound(b, 1), UBound(b, 2)).Value = b
End Sub


--------------
Let me know the result and I'll get back to you as soon as I can.
Sincerely
Dante Amor
--------------
 
Upvote 1
Solution
Hello @Kishan, thanks for posting on MrExcel.

Try this macro:

VBA Code:
Sub combin_13_2()
  Dim a As Variant, b As Variant
  Dim i As Long, j As Long, k As Long, m As Long, n As Long
 
  a = Range("A6:AX18").Value
  n = WorksheetFunction.Combin(13, 2) * 3
  ReDim b(1 To n, 1 To UBound(a, 2))
 
  For i = 1 To UBound(a, 1)
    For j = i + 1 To UBound(a, 1)
      m = m + 1
      For k = 1 To UBound(a, 2)
        b(m, k) = a(i, k)
        b(m + 1, k) = a(j, k)
      Next
      m = m + 2
    Next
  Next
 
  Range("A25").Resize(UBound(b, 1), UBound(b, 2)).Value = b
End Sub


--------------
Let me know the result and I'll get back to you as soon as I can.
Sincerely
Dante Amor
--------------
Hello Dante Amor,

I am very glad to see your post and this make me so happy after trying it. Incredible it copies combination of 78 rows in milliseconds what a nice solution. I am glad and value your help.

I wish you a good luck.

Kind Regards,
Kishan :)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top