Excel fits equations by least squares. STEYX(), RSQ(), LINEST(,,,TRUE),
and the ATP Regression tool perform standard statistical analyses based
on the least squares fit.
Help for SLOPE(), INTERCEPT(), STEYX(), RSQ(), and LINEST() gives
formulas. The ATP regression tool uses LINEST(). You don't mention
your version of Excel. Excel 2003 uses mathematically equivalent but
numerically superior formulas to earlier versions (documented in Help).
The formulas that Alex gave applay to pre-2003 versions.
If you mean multiple linear regression (instead of simple linear
regression), then LINEST in versions prior to 2003 directly solves the
normal equations
b = MMULT(MINVERSE(XpX),Xpy)
where XpX = MMULT(TRANSPOSE(X),X) and Xpy = MMULT(TRANSPOSE(X),y)
for y the vector of observations, X the X-matrix, and b the vector of
estimates. Excel 2003 uses a more complicated algorithm
http://support.microsoft.com/default.aspx?scid=kb;en-us;828533
That in most cases is far better numerically than older versions, but on
occasion may zero estimates that should not be zeroed
http://groups.google.com/groups?threadm=412980D4.5040305@no_e-mail.com
Jerry