title: Computing conditional SLOPE
body: <p>I have a simple spreadsheet, where column A is a bunch of dates (ascending) and column B is a bunch of values. Finding the OLS slope is easy:</p>
  
  <pre><code>SLOPE(B2:B161,A2:A161)
  </code></pre>
  
  <p>But I don't want the slope of everything. I want to see the slope for each month. So if C3 is "3", I'd want to do something like:</p>
  
  <pre><code>SLOPE(IF(MONTH(A2:A161)==C3,B2:B161), A2:A161)
  </code></pre>
  
  <p>Which is wrong, but hopefully conveys what I'm trying to do. How do I actually do this?</p>