title: How to list all possible combinations of the values in three columns in excel?
body: <p>I have three columns, each of which has different kinds of master data as shown below:</p>
  
  <p><a href="https://i.stack.imgur.com/19ZZ7.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/19ZZ7.jpg" alt="enter image description here"></a></p>
  
  <p>Now, I want to have all possible combinations of these three cells - like</p>
  
  <pre><code>aa kk jj
  aa kk ff
  aa ll jj
  aa ll ff
  aa mm jj
  ...
  </code></pre>
  
  <p>Can this be done with a formula. I found one formula with 2 columns, but i'm not able to extend it to 3 columns correctly</p>
  
  <p>Formula with 2 columns:</p>
  
  <pre><code>=IF(ROW()-ROW($G$1)+1&gt;COUNTA($A$2:$A$15)*COUNTA($B$2:$B$4),"",
  INDEX($A$2:$A$15,INT((ROW()-ROW($G$1))/COUNTA($B$2:$B$4)+1))&amp;
  INDEX($B$2:$B$4,MOD(ROW()-ROW($G$1),COUNTA($B$2:$B$4))+1))
  </code></pre>
  
  <p>where G1 is the cell to place the resulting value </p>