Is it possible to permutate in Excel

  • Thread starter Thread starter Henrik
  • Start date Start date
H

Henrik

Is it possible to permutate three arrays of numbers in
Excel?

For instance:

Array 1: [a,b,c,d]
Array 2: [A,B,C,D]
Array 3: [1,2,3,4]

I want to solve for every singe combination of Array 1 *
Array 2 * Array 3 (a*A*1, a*A*2, a*A*3, etc.). Is it
possible to automate this process by writing a macro or VB
Script or by another method? Your help is very much
appreciated.
 
I am guessing this is what you want

Sub Combos()
arr1 = Array("a", "b", "c", "d")
arr2 = Array("A", "B", "C", "D")
arr3 = Array("1", "2", "3", "4")
rw = 1
For i = LBound(arr1) To UBound(arr1)
For j = LBound(arr2) To UBound(arr2)
For k = LBound(arr3) To UBound(arr3)
Cells(rw, 1) = arr1(i) & "*" & _
arr2(j) & "*" & arr3(k)
rw = rw + 1
Next: Next: Next
End Sub
 
Back
Top