ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trendline in charts (https://www.excelbanter.com/excel-programming/309760-re-trendline-charts.html)

Tom Ogilvy

Trendline in charts
 
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.htm

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?thre...GP09.p hx.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




K Dales

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



.


Jerry W. Lewis

Trendline in charts
 
as has David Braden

http://groups.google.com/groups?selm....microsoft.com

Jerry

Tom Ogilvy wrote:

....

Chip Pearson posted some code to get the values from the chart itself:

http://groups.google.com/groups?thre...GP09.p hx.gbl



Jerry W. Lewis

Trendline in charts
 
These functions only apply to simple linear regression. There are many
other trendlines that chart can fit, and the OP has not specified what
kind of trendline.

Jerry

K Dales wrote:

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


.




K Dales

Trendline in charts
 
Understood; but if the linear formula is all that is
wanted certainly this is easier and faster.

-----Original Message-----
These functions only apply to simple linear regression.

There are many
other trendlines that chart can fit, and the OP has not

specified what
kind of trendline.

Jerry

K Dales wrote:

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/ExcelTips/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

news:F5236D26-F95C-4727-BE44-

...

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


.



.


Jerry W. Lewis

Trendline in charts
 
True

Jerry

K Dales wrote:

Understood; but if the linear formula is all that is
wanted certainly this is easier and faster.


-----Original Message-----
These functions only apply to simple linear regression.

There are many

other trendlines that chart can fit, and the OP has not

specified what

kind of trendline.

Jerry

K Dales wrote:


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/ExcelTips/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


news:F5236D26-F95C-4727-BE44-

...

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


.



.




Dr.Schwartz

Trendline in charts
 
Thank you Mr. Dales. This was exactly what I was looking for!

"K Dales" wrote:

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



.




All times are GMT +1. The time now is 11:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com