Would like to create 5th- order polynomial trendline from data set and have
coefficients automatically displayed in excel cells (one in each cell)
Would like to create 5th- order polynomial trendline from data set and have
coefficients automatically displayed in excel cells (one in each cell)
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:=xlPolynomial, _
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)
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks