ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   5th-odr poly coefficients automatically displayed in excel cells? (https://www.excelbanter.com/excel-programming/338369-5th-odr-poly-coefficients-automatically-displayed-excel-cells.html)

jason1

5th-odr poly coefficients automatically displayed in excel cells?
 
Would like to create 5th- order polynomial trendline from data set and have
coefficients automatically displayed in excel cells (one in each cell)

sebastienm

5th-odr poly coefficients automatically displayed in excel cells?
 
Hi,
The following code adds a trendline (5th-order poly) to the first series on
the active chart:
'--------------------------------------------
Sub test()
Dim c As Chart, t As Trendline
Set c = ActiveChart

'check chart
If c Is Nothing Then
MsgBox "No chart selected"
Exit Sub
End If

'add trendline to series 1
Set t = c.SeriesCollection(1).Trendlines.Add(Type:=xlPolyn omial, _
Order:=5, Forward:=0, Backward:=0, DisplayEquation:=True, _
DisplayRSquared:=False)

End Sub
'------------------------------------------
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"jason1" wrote:

Would like to create 5th- order polynomial trendline from data set and have
coefficients automatically displayed in excel cells (one in each cell)


Mike Middleton[_4_]

5th-odr poly coefficients automatically displayed in excel cells?
 
jason1 -

Would like to create 5th- order polynomial trendline from data set and
have coefficients automatically displayed in excel cells (one in each
cell) <


(1) Do you actually think there is some real-world data where the underlying
process should be represented with a 5th-order polynomial? Be aware of
possible overfitting the data in which case predictions are of dubious
value.

(2) But if you really want to do it, you could use the LINEST array-entered
worksheet function.

Tushar Mehta has some examples and tutorials at www.tushar-mehta.com.

- Mike
www.mikemiddleton.com




All times are GMT +1. The time now is 11:01 PM.

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