By r do you mean Pearson's correlation coefficient that represents the "goodness of fit" of a correlation?

If you just need r but not the actual correlation, I'm amost certain there is a built in function for that (search Excel help for pearson's r or similar).

If you want to get r with the correlation, you can use the LINEST function (set final optional parameter to true).

Or you can use the regression tool in the built in data analysis tools. In my older version of Excel, this is found on the Data menu -- I don't know where Microsoft put it in the newer versions.