=LINEST(ydata,xdata^{1,2,3},const,TRUE) returns R^2 in the 3rd row, 1st
column. You can use the INDEX() function to return a value from a specific
location of an array.
If you want to calculate it from first principles, then
R^2 = SSR/SSE
While not the numerically best approach (which is not closed form),
SSR = SUMSQ(predicteds)-n*AVERAGE(ydata)^2
SSE = SUMSQ(ydata)-SUMSQ(predicteds)
If you are not fitting a constant term, then do not subtract the correction
term
n*AVERAGE(ydata)^2
Jerry