View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales K Dales is offline
external usenet poster
 
Posts: 131
Default Trendline in charts

Here is a worksheet formula to display the equation of the
line in one step (where XRange and YRange are the
corresponding coefficient ranges):

="y = "&TEXT(SLOPE(YRange,XRange),"#.####")&"x "&TEXT
(INTERCEPT(YRange,XRange),"+ #.####;- #.####")

The R squared value is
="R squared = "&TEXT(RSQ(YRange,XRange),"#.####")

-----Original Message-----
One way would be to use Linest or forecast or slope

worksheet functions
against the source data.

You can see how Bernard Liengme solves for the

coefficients of a polynomial
curve using LINEST.
http://www.stfx.ca/people/bliengme/E.../Polynomial.ht

m

probably could be adapted to other type curves (an not

adpation need for
straight line).

Chip Pearson posted some code to get the values from the

chart itself:

http://groups.google.com/groups?threadm=%

23hup3qhhEHA.1652%40TK2MSFTNGP09.phx.gbl

--
Regards,
Tom Ogilvy

"Dr.Schwartz"

wrote in message
...
When manually adding a trendline to a chart the

equation and Rsquared can
be
displayed (DisplayEquation:=True,

DisplayRSquared:=True). Is there any way
to
insert these values in two cells instead.

Thanks
The Doctor



.