Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default B = Y Intercept

I used the two functions slope and Intercept but for some
reason the intercept is coming out wrong. Here is the
code...
Slope = Application.WorksheetFunction.Slope(Range
("e25:e28"), Range("c25:c28"))

Intercept = Application.WorksheetFunction.Intercept(Range
("e25:e28"), Range("c25:c28"))

The label on the graph shows y = 14484x + 562698 and so
my code should produce the same results but it doesn't...

My slope is 14483.664 (good)
My intercept is -28390146.1562596 (bad) should be 562698

Thoughts?: The 0nly thing I can think of is that the
values in the "c" range are 2000,2001,2002,2003 and
somehow my answer is the Y intercept at the year 0????

Or maybe the datatypes are causing a bad answer..one cell
range has the Excel 'Number' datatype and the other cell
range is the Excel 'Currency' datatype

Please advise
Alex.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default B = Y Intercept

My guess is that your graph is a "Line" chart instead of an "XY
(Scatter)" chart. If so, then the VBA intercept is correct because the
graph equation is based on the assumption that the X data is 1,2,3,4
(2000,2001,2002,2003 are just x labels, not x values in a "Line" chart).

Jerry

Alex A wrote:

I used the two functions slope and Intercept but for some
reason the intercept is coming out wrong. Here is the
code...
Slope = Application.WorksheetFunction.Slope(Range
("e25:e28"), Range("c25:c28"))

Intercept = Application.WorksheetFunction.Intercept(Range
("e25:e28"), Range("c25:c28"))

The label on the graph shows y = 14484x + 562698 and so
my code should produce the same results but it doesn't...

My slope is 14483.664 (good)
My intercept is -28390146.1562596 (bad) should be 562698

Thoughts?: The 0nly thing I can think of is that the
values in the "c" range are 2000,2001,2002,2003 and
somehow my answer is the Y intercept at the year 0????

Or maybe the datatypes are causing a bad answer..one cell
range has the Excel 'Number' datatype and the other cell
range is the Excel 'Currency' datatype

Please advise
Alex.


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
How do I force the y-intercept value Tony41 Excel Worksheet Functions 0 February 4th 10 06:14 PM
Regression with zero intercept TheMoth Excel Worksheet Functions 2 January 19th 08 10:14 PM
regression using set intercept Canary Pete Excel Discussion (Misc queries) 4 November 18th 06 02:37 PM
Regression intercept to 0 squalidae Excel Worksheet Functions 2 February 22nd 06 05:56 AM
Intercept and Indirect Graham Haughs Excel Worksheet Functions 2 February 19th 06 06:51 AM


All times are GMT +1. The time now is 07:27 PM.

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"