Need VBA macro to list combinations from data from left to right only, please!

Estatefinds

Board Regular
Joined
Sep 14, 2015
Messages
169
So I need a macro that will run in which the data in column DC the first digit will be placed for example the number 6 then it will look in the next column labeled row 2 for the next digit higher which would be 13 then I t would look in the next column labeled row3 the next number higher which would be 14, then to the next column labeled row 4, the next number would be 15, then to the next column labeled row 5 the next number higher up would be 24; Until five numbers make up the combination. The combiations will only be made left to right until all possible combinations are resulted in column GC13.
Then it would start at lowest number in column DD for example will start with the number 1 and result all combinations into column GD13.
6142919532187328311120
8131015242112
17301416332722
2326253529
34
Row 1Row 2Row 3Row 4Row 5Row 6Row 7Row 8Row 9Row 10Row 11Row 12Row 13Row 14Row 15Row 16Row 17Row 18Row 19Row 20Row 21Row 22Row 23Row 24Row 25Row 26Row 27Row 28Row 29Row 30Row 31Row 32Row 33Row 34Row 35

<tbody>
</tbody>
6-13-14-15-24
6-13-26-33-35
and so on

also no number can be used from the same Column meaning a value from row 1 be used with a row 1 value the combinations will be built from smallest value to largest left to right only.
Thank you!
Sincerely Dennis
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Estatefinds

Board Regular
Joined
Sep 14, 2015
Messages
169
the combinations that start with the first value of the combination that is found in the column labeled Row 1 will be listed below in the column labeled row 1. the combinations that start with the first value of the combination that is found in the column labeled row 2 will be listed below in the column labeled row 2 and so on until no others combinations can be made from left to right.
 
Last edited:

Estatefinds

Board Regular
Joined
Sep 14, 2015
Messages
169
Row 1Row 2Row 3Row 4Row 5Row 6Row 7Row 8Row 9Row 10Row 11Row 12Row 13Row 14Row 15Row 16Row 17Row 18Row 19Row 20Row 21Row 22Row 23Row 24Row 25Row 26Row 27Row 28Row 29Row 30Row 31Row 32Row 33Row 34Row 35
A1A2A3A4C5B6A7E8C9B10A14E15E18B19C26
B1B2B3B4D5C6B7
C1D2C3C4E5D6C7
D1D3D4E6D7
E1
6142919532187328311120
8131015242112
17301416332722
2326253529
34
Row 1Row 2Row 3Row 4Row 5Row 6Row 7Row 8Row 9Row 10Row 11Row 12Row 13Row 14Row 15Row 16Row 17Row 18Row 19Row 20Row 21Row 22Row 23Row 24Row 25Row 26Row 27Row 28Row 29Row 30Row 31Row 32Row 33Row 34Row 35
6-13-14-15-241-4-15-24-27
6-13-14-15-331-4-15-24-35
6-13-14-15-271-4-15-24-29
6-13-14-15-191-4-15-24-32
6-13-14-15-211-4-15-24-28
6-13-14-15-271-4-15-24-31
6-13-14-15-35an so on
6-13-14-15-22
6-13-14-15-29
6-13-14-15-32
6-13-14-15-18
6-13-14-15-28
6-13-14-15-31
6-13-14-15-20
an so on

<colgroup><col><col span="2"><col><col><col><col><col><col><col><col span="2"><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>
 

Estatefinds

Board Regular
Joined
Sep 14, 2015
Messages
169
OK SO i HAVE A CORRECTION same concept but the macro needs to look at smallest number and look to the left of where it is and look tothe next number up to build a combination of five numbers and build all possible combinations to the left of where this number is found and id there are not enough numbers to the left to build it, it will look to the right and build combinations. so for example for smplicity it look at the value 7 in the column DL labeled row 10 it will look to the left of the column DL and take a number that is higher than seven and start to build a combination and take one value from each column to the left. and it will keep doing this until all combinations are made and place these results in column GL which is labeled row 10 but the results will be placed at location on worksheet GL row 21 which the GL column is labeled ROW 10. then once the left direction of the combinations are done it will look to the right of where the 7 value is found to see if it can take a number higher than 7 to start building a five value combinations. so if you look in the data example the value of 7 which is labeled row 10 the numbers to the right are 3,28,31,11 so the the macro would look at this and see a five number combinations cant be made cause it starts from left to right at the 7 so for example 7 the next number up is 11 then 28, then 31 there are only four numbers so this wouldnt work it would stop there. and do a another search through all the values in the data DC13 to EK17.
here is a clip from the data so the value 6 only looks to the right as there is no data to the left to look for numbers to build a combination from right to left, but does from left to right and since the number 6 is found in the column DC labeled column row 1 the combination results get placed in the column. also the resulted combinations will be placed in columns GC to HK starting on row 13. which are labeled row 1 to row 35 on row 12 for the label. also keep in mind the value the combination starts with and which ever labeled row it is found those results will go in under that labeled row. so for the value of 6 below it is found on labeled row 1 so all the combinations starting with value of 6 will go in the labeled row 1.
6142919532187
8131015242112
17301416332722
2326253529
34
Row 1Row 2Row 3Row 4Row 5Row 6Row 7Row 8Row 9Row 10
6-13-14-15-241-4-15-24-27
6-13-14-15-331-4-15-24-35
6-13-14-15-271-4-15-24-29
6-13-14-15-191-4-15-24-32
6-13-14-15-211-4-15-24-28
6-13-14-15-271-4-15-24-31
6-13-14-15-35an so on
6-13-14-15-22
6-13-14-15-29
6-13-14-15-32
6-13-14-15-18
6-13-14-15-28
6-13-14-15-31
6-13-14-15-20
an so on

<tbody>
</tbody>
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,123,402
Messages
5,601,475
Members
414,452
Latest member
Dannysamworth

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
Top