I have two values: 1 and 0. And I have 5 columns. I need to generate all possible arrangements in Excel.
For example, I have 2 columns and 2 values: 0 , 1. There are only 4 possible arrangements (with repetitions):
1 | 0
0 | 1
0 | 0
1 | 1
I need to generate all posible arrangements of 1 and 0 for 5 columns. Number of possible arrangements with repetition is defined by formula: n^k. So, for 5 columns and 2 values it is 2^5 = 32 arrangements.
In Excel:
and so on
Is it possible to automate it without typing ones and zeros manually?
You basically want to count from 0 to 31 in binary and then split the binary result out over the columns. You can do it like this:
=DEC2BIN(A2,5)
=MID($B2,C$1,1)
and then drag down and acrossFor example - for the formula to get the binary digit in the correct column: