Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A hopefully simple question about SLOPE()...

Howdy
I have two columns of data (X and Y values, a simple line) that I need to find the slope and y-intercept of with VBA. I've read about WorksheetFunction.Slope() and .Intercept as well as Index(LinEst()1), but my problem stems from my two datasets existing in array form. I retrieve the data from columns on a sheet, but perform several normalizing functions on the arrays before needing slope and intercept
The worksheet functions talk about accepting arrays as data, and you can pass the functions worksheet arrays {1;2;3;...}, but nothing doing in VBA. I've tried leaving the arrays two dimentional as well as converting them to one dimention per set. Any ideas, or am I going to have to pass the arrays back to a range and pass that to the function

Much appreciated
-Dustin Carter
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default A hopefully simple question about SLOPE()...

varrX = Array(1,2,3,4,5)
varrY = Array(5,7,3,6,8)
? worksheetFunction.Slope(varry,varrx)
0.5
? worksheetFunction.Intercept(varry,varrx)
4.3

works fine for me.

--
Regards,
Tom Ogilvy


"dcarter" wrote in message
...
Howdy,
I have two columns of data (X and Y values, a simple line) that I need

to find the slope and y-intercept of with VBA. I've read about
WorksheetFunction.Slope() and .Intercept as well as Index(LinEst()1), but my
problem stems from my two datasets existing in array form. I retrieve the
data from columns on a sheet, but perform several normalizing functions on
the arrays before needing slope and intercept.
The worksheet functions talk about accepting arrays as data, and you can

pass the functions worksheet arrays {1;2;3;...}, but nothing doing in VBA.
I've tried leaving the arrays two dimentional as well as converting them to
one dimention per set. Any ideas, or am I going to have to pass the arrays
back to a range and pass that to the function?

Much appreciated,
-Dustin Carter



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
hard slope question beto Excel Discussion (Misc queries) 2 April 29th 10 12:08 AM
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
Simple Slope Formulation lashio Excel Discussion (Misc queries) 3 June 15th 05 01:15 PM
simple question, hopefully a simple answer! Matt B Excel Programming 5 January 13th 04 08:43 PM


All times are GMT +1. The time now is 11:51 AM.

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

About Us

"It's about Microsoft Excel"