title: Excel CountIF on date AND time
body: <p>I see lots of examples of how to work with times <strong>OR</strong> dates, but not a lot seems to be done with date <strong>AND</strong> time values.</p>
  
  <p>I have the following data:</p>
  
  <p><img src="https://i.stack.imgur.com/9TOWU.png" alt="Data e.g."></p>
  
  <p>And would like the sum of some weights between specific date and times (shift patterns):</p>
  
  <p>So</p>
  
  <ol>
  <li>I need all the weights between "17/07/2014 06:00" and "17/07/2014 14:00"</li>
  <li>I need all the weights between "17/07/2014 14:00" and "17/07/2014 22:00"</li>
  <li>I need all the weights between "17/07/2014 22:00" and "<strong>18</strong>/07/2014 06:00"</li>
  </ol>
  
  <p>Yes, I can split the dates and times and deal with them separately, but there must be an easier way (it gets rather convoluted in the 3rd scenario)</p>
  
  <p>By the way, the date to compare against will be calculated using "=DATE(YEAR(NOW()),MONTH(NOW()),DAY(NOW())-1)" for yesterdays date (stored in F11)</p>
  
  <p>I have an entire page of different variations of attempts at this, which I wont post all of, but mainly:</p>
  
  <pre><code> =SUMIFS(
     Last36Hours!$K$2:$K$10000,
     Last36Hours!$T$2:$T$10000,"&gt;=" &amp; 
        DATE(YEAR(F11),MONTH(F11),DAY(F11)) &amp; 
        TIME(6,0,0)
   )
  </code></pre>
  
  <p>should give me everything after yesterday 6am, but i get absolutely squat.</p>