ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Generate data with all combinations (https://www.excelbanter.com/excel-programming/420592-generate-data-all-combinations.html)

Venkatesh V

Generate data with all combinations
 
HI,

Please provide help on how to generate data on all comibinations
in an excel I have 3 clumns
Sec - has 4 values
Acc - has 8 values
Type - 4 values

with the available data, i reuqire either an addin or macro or any tiool
that would generate data will all the combinations of values

so, with the above example - excel shoud have: 4 * 8* 4 =128 rows in excel.

how to do it?

Thanks,
Venkat

Gary''s Student

Generate data with all combinations
 
Sub Venkatesh()
sec = Array("sec1", "sec2", "sec3", "sec4")
acc = Array(1, 2, 3, 4, 5, 6, 7, 8)
tipe = Array("t1", "t2", "t3", "t4")
L = 1
For i = 0 To 3
For j = 0 To 7
For k = 0 To 3
Cells(L, 1).Value = sec(i)
Cells(L, 2).Value = acc(j)
Cells(L, 3).Value = tipe(k)
L = L + 1
Next
Next
Next
End Sub

Naturally, put your own values in the array statements.
--
Gary''s Student - gsnu200816


"Venkatesh V" wrote:

HI,

Please provide help on how to generate data on all comibinations
in an excel I have 3 clumns
Sec - has 4 values
Acc - has 8 values
Type - 4 values

with the available data, i reuqire either an addin or macro or any tiool
that would generate data will all the combinations of values

so, with the above example - excel shoud have: 4 * 8* 4 =128 rows in excel.

how to do it?

Thanks,
Venkat


Venkatesh V

Generate data with all combinations
 
excellent. thanks

"Gary''s Student" wrote:

Sub Venkatesh()
sec = Array("sec1", "sec2", "sec3", "sec4")
acc = Array(1, 2, 3, 4, 5, 6, 7, 8)
tipe = Array("t1", "t2", "t3", "t4")
L = 1
For i = 0 To 3
For j = 0 To 7
For k = 0 To 3
Cells(L, 1).Value = sec(i)
Cells(L, 2).Value = acc(j)
Cells(L, 3).Value = tipe(k)
L = L + 1
Next
Next
Next
End Sub

Naturally, put your own values in the array statements.
--
Gary''s Student - gsnu200816


"Venkatesh V" wrote:

HI,

Please provide help on how to generate data on all comibinations
in an excel I have 3 clumns
Sec - has 4 values
Acc - has 8 values
Type - 4 values

with the available data, i reuqire either an addin or macro or any tiool
that would generate data will all the combinations of values

so, with the above example - excel shoud have: 4 * 8* 4 =128 rows in excel.

how to do it?

Thanks,
Venkat



All times are GMT +1. The time now is 12:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com