title: Dynamic number of WHERE conditions in Google Sheet query function
body: <p>I'm building  a spreadsheet that can be used to import and then filter wireshark capture .csv's.  The idea is - you import the .csv into the second tab, and on the first tab you are able to display the data based on a number of include/exclude filters. Here is a dummy sheet for reference:</p>
  
  <p><a href="https://docs.google.com/spreadsheets/d/17TtZHRiXCaH1XClq5SGRdIuyLZnMOrl6Ygrbfo9BbfM/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/17TtZHRiXCaH1XClq5SGRdIuyLZnMOrl6Ygrbfo9BbfM/edit?usp=sharing</a></p>
  
  <p>As you can see in the spreadsheet, I have four possible "include" values and four possible "exclude" values, each being determined by selection of a drop down-list.  The intention is for the QUERY() function in cell A6 to display the data based on these filters.<br>
  <a href="https://i.stack.imgur.com/SP1gR.png" rel="nofollow noreferrer">Example of the filter at work</a></p>
  
  <p>I know how to use WHERE to do it for a single filter condition:</p>
  
  <blockquote>
    <p>=query('Import CSV Here'!1:349,"select * where ("&amp;B4&amp;"="&amp;B2&amp;")")</p>
  </blockquote>
  
  <p>And how to do it for multiple filter conditions:</p>
  
  <blockquote>
    <p>=query('Import CSV Here'!1:349,"select * where ("&amp;B4&amp;"="&amp;B2&amp;") and ("&amp;C4&amp;"="&amp;C2&amp;")" )  </p>
  </blockquote>
  
  <p>What I can't figure out is how to write the QUERY function so that it only factors in a WHERE condition for filter columns that aren't blank (and therefore have been actively populated from their drop down menus).   Is there an efficient way to do this?</p>