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: 9
Default LinEst function

Hello,

I would like to use the linest function in a macro of mine. I have actually
got it working (example added below). The only problem is that when I
increase the size of x (input data) I get a 1004 error. Doesn't make sense
to me. Is there a limit on the number of parameters that the function can
handle?? Is there anybody that has done a "least squares" macro themselves
that can handle big amounts of data (more than 100 input columns or so)?

Kind regards, Darius Blaszijk

Option Base 1
Sub Test()

Dim y(11, 1) As Double
Dim x(11, 4) As Double

For i = 1 To 11
y(i, 1) = ActiveSheet.Cells(i + 1, 5)
Next i

For c = 1 To 4
For r = 1 To 11
x(r, c) = ActiveSheet.Cells(r + 1, c)
Next r
Next c

t = Application.WorksheetFunction.LinEst(y, x, True, True)

For i = 4 To 1 Step -1
ActiveSheet.Cells(17, i) = t(1, 5 - i)
Next i
ActiveSheet.Cells(17, 5) = t(1, 5)

r = t(3, 1)
ActiveSheet.Cells(17, 6) = r
End Sub


 
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
Deriving P-Value through LINEST Function RJ Excel Worksheet Functions 2 May 2nd 23 03:46 AM
linest function for curve Baffeled Excel Discussion (Misc queries) 2 February 4th 09 01:18 PM
LINEST Function mcduffcpa Excel Discussion (Misc queries) 5 January 5th 09 07:26 PM
Linest function Barna Excel Worksheet Functions 1 February 16th 07 11:43 PM
LinEst embedded in VBA Function Warren H Excel Programming 1 November 12th 03 01:45 PM


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