Home » excel » excel – Computing conditional SLOPE

excel – Computing conditional SLOPE

Posted by: admin May 14, 2020 Leave a comment


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:


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:

SLOPE(IF(MONTH(A2:A161)==C3,B2:B161), A2:A161)

Which is wrong, but hopefully conveys what I’m trying to do. How do I actually do this?

How to&Answers:

You’ve got the right idea more or less. Try the following, but instead of just pressing enter to commit the value to the cell, press Control+Shift+Enter (CSE) which turns it into an array formula and makes it behave the way you’d like.