Slope of a line given multiple points [closed]

I have data with a starting (y) value that sequentially increments/decrements as (x) time measured in days passes.
I found this link for creating a linear regression of the data
http://www.easycalculation.com/statistics/regression.php

I would like to automate the slope calculation in excel. Does anyone have an idea of how to do it? I see the math formula at the bottom of the page

NXYXYNX2(X)2

but i don’t know how to translate it to an excel formula. The problem is mainly the XY and X2. The others are easy with the count, sum and pow function.
My x coordinates and y coordinates are in rows such that C1 is x1 and D1 is x2.

Answer

First, note that your link links to a worked example that will probably help.

To implement the equation in Excel:

  1. make a new column labeled “XY” in E
  2. enter the number of rows in cell “F2” (this will be N)
  3. label column F “X^2”
  4. enter =C2^2 into F2 to caclulate X^2, highlight F2:FN and hit ctrl+D to fill this equation down
  5. enter the equation =(G2*sum(E:E) - sum(C:C)*sum(D:D))/(G2*sum(F:F) - sum(C:C)^2) into an empty cell. This will be your R^2
  6. enter the equation =slope(D:D, C:C) into another empty cell, this should match your calculation.

Finished result is shown in an example google doc that can be downloaded in Excel format here.

Attribution
Source : Link , Question Author : Community , Answer Author : David LeBauer

Leave a Comment