I'd like a formula for Google Sheets, but I'm having trouble figuring it out.

Say I'm on B74, I want the equivalent of =SLOPE(B36:B63,A36:A63). However, I want something that will work even when I add a new row under 63. At which point, I want =SLOPE(B37:B64,A37:A64).

I used =AVERAGE(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN())),-38,,28)) works perfectly to get the average value within this range, but I can't figure out one for slope.


1 Answer 1


The answer depends on how your sheet is laid out. You are saying that the formula is in cell B74. If there are no more numbers in the sheet between the data table and the formula cell, you can modify the range references so that they include all rows until row 73, like this:

=slope(B36:B73, A36:A73)

Empty rows are ignored by slope().

If the data table is the last thing in columns A:B, and you can move the formula cell elsewhere, say column C, you can use open-ended references like this:

=slope(B36:B, A36:A)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.