# List all possible combinations of 3 variables

#### abberyfarm

##### Well-known Member
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

 * A B C 1 00:00:00 1 1 2 00:15:00 2 2 3 00:30:00 3 3

<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.
Wrong answer (so I deleted the text)

A total of 437,760 combinations; is that right?

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.

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

Would a non-VBA (just formula) solution interest you at this point?

Hi Benmiller,

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

Regards

John

Replies
0
Views
109
Replies
1
Views
324
Replies
3
Views
131
Replies
15
Views
400
Replies
0
Views
108

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.

### Which adblocker are you using?

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

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