List all possible combinations of 3 variables

abberyfarm

Well-known Member
Joined
Aug 14, 2011
Messages
733
Hi there,

Would anybody know how I could create all possible combinations of 3 variables in Columns A,B and C.

I have the following

1. time values in 15minute blocks i.e. 00:15:00, 00:30:00....23:45:00

2. A set of numbers from 1 to 76.

3. A set of numbers list of 1 to 60.

So it the first 3 combinations would look something like this

Sheet1

*ABC
100:00:0011
200:15:0022
300:30:0033

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Appreciate any help

Thank you

John
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
A total of 437,760 combinations; is that right?
 
Upvote 0
Hi,
try the macro:
Code:
Sub MuchComb()
Dim i&, a&, b&, tbl1(), tbltime()

ReDim tbl(1 To 2, 1 To 4560)

For i = 1 To 4560
  a = 1 + Int((i - 1) / 60)
  b = i Mod 60
  If b = 0 Then b = 60
  tbl(1, i) = a
  tbl(2, i) = b
Next i

ReDim tbltime(1 To 4560)

For i = 1 To 96
  
  For j = 1 To 4560
   tbltime(j) = TimeSerial(0, 15 * (i - 1), 0)
  Next j
  
  a = 4560 * i - 4559
  Cells(a, 2).Resize(4560, 2) = Application.Transpose(tbl)
  Cells(a, 1).Resize(4560) = Application.Transpose(tbltime)
Next i

End Sub
Best regards.
 
Upvote 0
Hello Hurgadian,

Thank you for your help,that code works perfect. I appreciate your time.

Also thank you to Benmiller and Oeldere for your help.

Regards

JOhn
 
Upvote 0
Would a non-VBA (just formula) solution interest you at this point?
 
Upvote 0
Hi Benmiller,

Thank you for your help. The vba code above is suitable for what I am looking for. Thanks again.


Regards

John
 
Upvote 0

Forum statistics

Threads
1,203,465
Messages
6,055,576
Members
444,799
Latest member
CraigCrowhurst

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