Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since I offered an ODBC approach I thought I should elaborate on it, as it is not immediately obvious how to do this. And, in honesty, I needed to relearn the process and document it for myself. </p> <p>This is a way to generate a <a href="https://www.google.com/search?q=define%3A%20cartesian%20product&amp;oq=define%3A%20cartesian%20product" rel="noreferrer" title="Cartesian product">Cartesian product</a> of two or more one-dimensional data arrays using Excel and Microsoft Query.</p> <p>These instructions were written with XL2007 but should work with minor (if any) modifications in any version.</p> <h2>Step 1</h2> <p>Organize the arrays in columns. </p> <p><em>Important:</em> Each column should have two "header" names as shown in bold below. The topmost name will later be interpreted as a "table name". The second name will be interpreted as a "column name". This will become apparent a few steps later.</p> <p>Select each data range in turn, including both "headers", and hit <code>Ctrl+Shift+F3</code>. Tick only <code>Top row</code> in the 'Create Names" dialog and click <code>OK</code>.</p> <p>Once all named ranges are established, save the file.</p> <p><img src="https://i.stack.imgur.com/ulUUw.png" alt="enter image description here"></p> <h2>Step 2</h2> <p>Data | Get External Data | From Other Sources | From Microsoft Query</p> <p>Choose <code>&lt;New Data Source&gt;</code>. In the <code>Choose New Data Source</code> dialog:</p> <ol> <li><p>A friendly name for your connection</p></li> <li><p>choose the appropriate Microsoft Excel driver</p></li> </ol> <p>... then <code>Connect</code></p> <p><img src="https://i.stack.imgur.com/zayj3.png" alt="enter image description here"></p> <h2>Step 3</h2> <p><code>Select Workbook...</code> then browse for your file.</p> <p><img src="https://i.stack.imgur.com/veIrk.png" alt="enter image description here"></p> <h2>Step 4</h2> <p>Add the "columns" from your "tables". You can see now why the "two header" layout in step 1 is important--it tricks the driver into understanding the data correctly.</p> <p>Next click <code>Cancel</code> (really!). You might be prompted at this point to "continue editing in Microsoft Query?" (answer <code>Yes</code>), or a complaint that joins cannot be represented in the graphical editor. Ignore this and forge on...</p> <p><img src="https://i.stack.imgur.com/k11E1.png" alt="enter image description here"></p> <h2>Step 5</h2> <p>Microsoft Query opens, and by default the tables you added will be cross-joined. This will generate a Cartesian product, which is what we want.</p> <p>Now close MSQuery altogether.</p> <p><img src="https://i.stack.imgur.com/HlZsE.png" alt="enter image description here"></p> <h2>Step 6</h2> <p>You are returned to the worksheet. Almost done, I promise! Tick <code>New worksheet</code> and <code>OK</code>.</p> <p><img src="https://i.stack.imgur.com/nCRWx.png" alt="enter image description here"></p> <h2>Step 7</h2> <p>The cross-joined results are returned. </p> <p><img src="https://i.stack.imgur.com/BqkKC.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload