title: Comparing dates in Google Sheets QUERY() formula
body: <p>Looking for some assistance please.</p>
  
  <p>To start, here's the function that I'm having trouble with: </p>
  
  <pre><code>=IFERROR(
    QUERY(
      OrderDetails!A8:Q9,
      "SELECT SUM(J) where Q &gt;= date '" &amp; TEXT(D3,"yyyy-mm-dd") &amp; "' label sum(J) ''"
    ),
    0
  )
  </code></pre>
  
  <p>The dates in the data range (<code>OrderDetails!A8:Q9</code>, columns P is <strong>Date</strong> &amp; Q is <strong>DateOnly</strong>) look like this: </p>
  
  <p><img src="https://i.stack.imgur.com/3s4Ms.png" alt="data range"></p>
  
  <p>I added Q manually in an attempt to make the date-matching work, but P is the raw data which I would prefer to use.</p>
  
  <p>Next the <code>SUM(J)</code> which are just order balances. If I remove the WHERE clause the query runs as expected.</p>
  
  <p>D3 is the column date I want to match to, in the format: 8/13/2018, however I've formatted it on screen to be only DDD.</p>
  
  <p><img src="https://i.stack.imgur.com/ZdeDr.png" alt="D3 Date"></p>
  
  <p>To show the actual value rather than the header in the cell, I've used <code>label sum(J) ' '</code>.</p>
  
  <p>When running I get the message "Nothing to return".</p>
  
  <p>Can anybody spot an obvious error with the code or my approach? Happy to add any further detail if needed.</p>