title: Google Sheets: CountIf and Dates
body: <p>Haven't gotten any help through the Google Product Forums, so I'll try here. I've never had issues with this before so not sure what I'm missing now. I can't seem to make a rather simple formula work and I have no idea why. </p>
  
  <p><strong>For some reason, <code>=COUNTIF(SCHEDULE!$C$9:$C29,"&gt;="&amp;B$2)</code> returns 0, when I'm expecting it to return 21.</strong></p>
  
  <ul>
  <li>In <code>B2</code> is the date "6/25/2018", which is actually a reference to
  <code>SCHEDULE!C2</code>.  </li>
  <li>Am I just not understanding the logic correctly? "If the dates in <code>C9:C29</code> are after or equal to 6/25/2018, then count them." </li>
  <li>When I try it as <code>&lt;=</code> it doesn't work either. </li>
  <li>I don't think there is an issue with the dates being formatted using <code>TEXT(B2,"MM/DD/YYYY")</code> because other formulas seem to be working fine. </li>
  </ul>
  
  <p>Alternatively, I also tried using <code>SUM(QUERY)</code>, but that also got hung up when using the dates.</p>
  
  <p><code>=sum(query(SCHEDULE!A9:AB,"select count(F) where F='2004' and C &gt;= date '"&amp;TEXT(DATEVALUE(B2),"yyyy-mm-dd")&amp;"'",0))</code> </p>
  
  <p>You can see a test version of the sheet <a href="https://docs.google.com/spreadsheets/d/169GhvqL-rUJ9LhxWushOTi14fpEEXtO-hUmFTrfLorw/edit?usp=sharing" rel="noreferrer">HERE</a>. </p>
  
  <p>I am working from the REF sheet. </p>
  
  <p>You can see what I've tried in <code>Z6</code>, <code>Z7</code>, <code>Z8</code> and <code>AA6</code>. </p>
  
  <p>Any suggestions would be appreciated. I feel like I'm missing something obvious. I'm not sure if it's the fact that some of the dates from the SCHEDULE page are rendered using TEXT, but I can't figure this out. </p>