Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Coefficients of trendline

I have data obtained as following:
X: x1 x2 x3 x4 x5
Y: y1 y2 y3 y4 y5
(Five X Y values)
From abovementioned data, chart is made and equation of trendline
displayed. Question here.
I want to get coefficients of that equation of trendline (Using VBA)
without displaying it on chart (obtain local maximum values intentionally).
For equation of degree of 4 is easy but for degree of 3, 2 I can not obtain
by VBA programming
It is thankful of you for your comment

--
Message posted via http://www.officekb.com
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Coefficients of trendline

Assuming Y values are in A1:E1 and X values are in A2:E2 then:

Sub GetCoeffPower2()
Dim arr As Variant
Dim i As Long

arr = Evaluate("Linest(Transpose(A1:E1), Transpose(A2:E2)^{1, 2})")
For i = LBound(arr) To UBound(arr)
MsgBox arr(i)
Next
End Sub

Sub GetCoeffPower3()
Dim arr As Variant
Dim i As Long

arr = Evaluate("Linest(Transpose(A1:E1), Transpose(A2:E2)^{1, 2, 3})")
For i = LBound(arr) To UBound(arr)
MsgBox arr(i)
Next
End Sub

If the data are in columns then remove the Transpose function.

Regards,
Greg

"Phung Anh via OfficeKB.com" wrote:

I have data obtained as following:
X: x1 x2 x3 x4 x5
Y: y1 y2 y3 y4 y5
(Five X Y values)
From abovementioned data, chart is made and equation of trendline
displayed. Question here.
I want to get coefficients of that equation of trendline (Using VBA)
without displaying it on chart (obtain local maximum values intentionally).
For equation of degree of 4 is easy but for degree of 3, 2 I can not obtain
by VBA programming
It is thankful of you for your comment

--
Message posted via http://www.officekb.com

Reply
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
Display Coefficients of a Polynomial Trendline bmook Excel Worksheet Functions 3 August 9th 11 07:21 PM
Extracting Trendline Coefficients [email protected] Excel Discussion (Misc queries) 4 June 14th 07 05:57 PM
How to get polynome (or other type) coefficients of a trendline? GoranR Excel Discussion (Misc queries) 1 September 7th 05 12:46 PM
How to get polynome (or other type) coefficients of a trendline? GoranR Excel Discussion (Misc queries) 0 September 7th 05 07:31 AM
Trendline coefficients MrUniverseman Charts and Charting in Excel 3 May 18th 05 12:56 PM


All times are GMT +1. The time now is 11:16 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"