title: Count number of occurrences in 4-yr ranges
body: <p>I have a list of books and their publication dates. I want to know how many dates are in 4-year ranges. </p>
  
  <p>For example, I have 5 dates as 1998, 4 in 1999, 9 in 2000, and 2 in 2001. So in the range from 1998-2000, I have 20 books. </p>
  
  <p>I want to do that for 4-yr ranges back to 1800. </p>
  
  <p>How can I do without physically entering the formulas in each cell. I tried to do it in excel with COUNTIF formula but I don't know how do it without entering the formula in each cell. The publication dates are in column <code>D</code> and rows <code>2-161</code>. I listed the years 1800-2018 in column <code>H</code> so my formula is <code>=COUNTIF(D2:D161,H2)</code>.  That returns the correct number, but how do I quickly calculate the other years without typing a new formula in each cell? I tried dragging the + in the corner of the cell, but that changes the range in column <code>D</code>. I want to keep the range (column <code>D</code>) constant, but change the year in each row so the formula should be </p>
  
  <pre><code>=COUNTIF(D2:D161, H3)
  =COUNTIF(D2:D161, H4)
  =COUNTIF(D2:D161, H5)
  =COUNTIF(D2:D161, H6)
  etc.
  </code></pre>
  
  <p>But that doesn't actually group them into 4-yr ranges. Maybe there is another way to find that information quickly with another method, formula, program, etc.</p>
  
  <p>I don't know how to write code so if that is the way it needs done, please be specific on how to do it. Help would be greatly appreciated! Thank you!</p>