title: Parameterized query from Excel with IN clause
body: <p>I have a <code>MS Query</code> connection from <code>Excel 2016</code> sheet to <code>IBM DB2</code> database. I use parameterized query and link parameter values to Excel cell. While "singular value" clauses such as <code>= &lt; &gt; like</code> work, I can't get <code>IN</code> clause to work <em>with multiple values</em> but otherwise super simple query.</p>
  
  <p>Here's a simple demo dataset how I produce the parameter values:</p>
  
  <p><a href="https://i.stack.imgur.com/kwUzx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kwUzx.png" alt="enter image description here"></a></p>
  
  <p>Column D formula is <code>=IF(C2&gt;5,A2&amp;",","")</code> which checks column C value for higher than 5 and populates <code>ID</code> in column D if <code>TRUE</code>. I'm expecting to use a helper cell to merge/concat all values in column D which I want to use for <code>IN</code> clause as value (<em>yet to be completed</em>).</p>
  
  <p>How can I use <code>"value1, value2, value3, ..."</code> in a cell to run an <code>IN</code> clause query? <strong><em>Is it possible at all?</em></strong> <code>IN</code> clause works fine when the linked cell holds value <code>1</code> however <code>1, 3</code> produces error message:
  <code>"Bad parameter type. Microsoft Excel is expecting a different kind of value than what was provided"</code>.</p>
  
  <p>Using a separate parameter and <code>OR</code> clause for each cell technically looks to work, however in practice the dataset can easily reach 50-100 values which means crazy amount of parameter setup.</p>
  
  <p>Query itself is something as simple as:</p>
  
  <pre><code>select * from PRODUCTS a
  where a.prod_ID in (1,3)
  </code></pre>
  
  <p>or as Excel MS Query alternative:</p>
  
  <pre><code>select * from PRODUCTS a
  where a.prod_ID in ?
  </code></pre>