LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Trendline Data

If you mean to get the polynomial coefficients, try something
like the following:

Dim TL As Trendline
Dim A As Double, B As Double, C As Double, D As Double, E As
Double, F As Double, G As Double
Dim S As String
Dim Arr As Variant
Dim Pos As Integer
Set Ser = Chart1.SeriesCollection(1)
Set TL = Ser.Trendlines.Add(xlPolynomial, 6) ' change 6 to
appropriate order
TL.DisplayEquation = True



TL.DataLabel.NumberFormat = "0.000000000000000"
S = TL.DataLabel.Text
Pos = InStr(1, S, "=")
S = Mid(S, Pos + 1)
S = Replace(S, " + ", "|+")
S = Replace(S, " - ", "|-")
Arr = Split(S, "|")

A = 0: B = 0: C = 0: D = 0: E = 0: F = 0: G
= 0
' g
Pos = InStr(1, Arr(LBound(Arr) + 0), "x")
G = CDbl(Left(Arr(LBound(Arr) + 0), Pos - 1))

' f
Pos = InStr(1, Arr(LBound(Arr) + 1), "x")
F = CDbl(Left(Arr(LBound(Arr) + 1), Pos - 1))

' e
Pos = InStr(1, Arr(LBound(Arr) + 2), "x")
E = CDbl(Left(Arr(LBound(Arr) + 2), Pos - 1))

' D
Pos = InStr(1, Arr(LBound(Arr) + 3), "x")
D = CDbl(Left(Arr(LBound(Arr) + 3), Pos - 1))

' c
Pos = InStr(1, Arr(LBound(Arr) + 4), "x")
C = CDbl(Left(Arr(LBound(Arr) + 4), Pos - 1))

' b
Pos = InStr(1, Arr(LBound(Arr) + 5), "x")
B = CDbl(Left(Arr(LBound(Arr) + 5), Pos - 1))

' a
A = CDbl(Arr(UBound(Arr)))



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"MF_gyps" wrote in message
...
I am looking for an Excel function or Excel VB Macro function

that will allow
me access to the actual data for a chart polynomial trendline.
Does this functionality exist?



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
trendline for part of data terry Charts and Charting in Excel 6 April 21st 23 06:10 PM
How do I set a trendline for only say the first 25% of the data s. qwerty Charts and Charting in Excel 2 April 11th 07 05:42 PM
how to draw a trendline using two set of data? PY Charts and Charting in Excel 1 December 5th 06 01:27 PM
Trendline Chart Data steph44haf Charts and Charting in Excel 6 July 22nd 06 04:01 AM
How do I get a trendline for all data series, instead of just one. Dave Darling Charts and Charting in Excel 1 December 15th 04 02:03 AM


All times are GMT +1. The time now is 05:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"