A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hello,
I suggest NOT you use any worksheet function "solution" with an INDIRECT command in it. Please see my Excel Don't # 10:
http://sulprobil.com/Get\_it\_done/IT/Excel\_Fun/Excel\_Don-ts/excel\_don-ts.html
If I am not mistaken, all responses immediately assumed that you only have 6 variables with two values to permute on. I suggest NOT to restrict yourself too early and to implement a flexible approach with at least a minimum of VBA programming style.
Just for the fun of it I have added an additional value "dont know" for the variable Equipments (now showing "y", "n", and "dont know"). All of a sudden we got 96 permutations and guess which of all suggested approaches you can use now?
I have stored my sample file here:
https://dl.dropboxusercontent.com/u/6077606/Permutations\_in\_Excel.xlsm
(use my code at your own risk)
Option Explicit
Enum eColumns
eCol_LBound = 1
eCol_Option
eCol_Reg
eCol_Broch
eCol_Fac
eCol_Equip
eCol_Exp
eCol_Rev
eCol_Ubound
End Enum
Sub CreatePermut()
Dim vReg, vBroch, vFac, vEquip, vExp, vRev 'All variants
Dim lRow As Long
Dim ws As Worksheet
Set ws = ActiveWorkbook.Sheets("Sheet1")
Range(ws.Cells.Columns(eCol_LBound + 1), ws.Cells.Columns(eCol_Ubound - 1)).Delete
lRow = 1
Range(ws.Cells(1, eCol_LBound + 1), ws.Cells(1, eCol_Ubound - 1)).FormulaArray = _
Array("Options", "Registration", "Brochure", "Facility", "Equipment", _
"Expenses", "Revenue")
lRow = lRow + 1
For Each vReg In Array("y", "n")
For Each vBroch In Array("y", "n")
For Each vFac In Array("y", "n")
For Each vEquip In Array("y", "n", "dont know")
For Each vExp In Array("y", "n")
For Each vRev In Array("y", "n")
ws.Cells(lRow, eCol_Option) = "Option " & lRow - 1
ws.Cells(lRow, eCol_Reg) = vReg
ws.Cells(lRow, eCol_Broch) = vBroch
ws.Cells(lRow, eCol_Fac) = vFac
ws.Cells(lRow, eCol_Equip) = vEquip
ws.Cells(lRow, eCol_Exp) = vExp
ws.Cells(lRow, eCol_Rev) = vRev
lRow = lRow + 1
Debug.Assert lRow < 10000 'Rethink if breached
Next vRev
Next vExp
Next vEquip
Next vFac
Next vBroch
Next vReg
End Sub