Slope of a line given multiple points 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
$$\frac{N\sum XY- \sum X\sum Y}{N\sum X^2-(\sum X)^2}$$
but i don't know how to translate it to an excel formula. The problem is mainly the $\sum XY$ and $\sum X^2$. 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.
 A: A solution with R and the example data posted by @David and instructions on accessing data from google spreadsheets from the Revolutions blog
require(RCurl)
mycsv <- getURL("https://docs.google.com/spreadsheet/pub?key=0Ai_PDCcY5g2JdGNabGs0R0IyVzhrUFIxOVRoTXMzUUE&single=true&gid=0&range=C1%3AD11&output=csv")
mydata <- read.csv(textConnection(mycsv))

x <- mydata$X
    y <- mydata$Y
n <- nrow(mydata)
xy <- x*y
m <- (n*sum(xy)-sum(x)*sum(y)) / (n*sum(x^2)-sum(x)^2)
m

Or, you could use R's built-in function
lm(y~x)

A: First, note that your link links to a worked example that will probably help.
To implement the equation in Excel:


*

*make a new column labeled "XY" in E

*enter the number of rows in cell "F2" (this will be N)

*label column F "X^2"

*enter =C2^2 into F2 to caclulate X^2, highlight F2:FN and hit ctrl+D to fill this equation down

*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

*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.
A: Excel already contains a function called SLOPE. See this official help site for reference and an example.
A: With your X values in column A, and Y values in column B (no column headers):
=( (COUNT(A:A)*(SUMPRODUCT(A:A,B:B)) - (SUM(A:A)*SUM(B:B))) )/ 
 ( (COUNT(A:A)*SUMPRODUCT(A:A,A:A)) - (SUM(A:A)^2) )

If you want column headers, replace all A:A and B:B entries with the proper location of your values.
I figured this formula out so I could use the slope function in PowerPivot, which does not have a SLOPE formula.
