Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 367
Default straight line graph, really straight line..

Hello, i am trying to add a trendline to graph which has 4 points and is
supposed to be producing a straight line (but does not always), so due to
these slight variations, the formula that i get from the trendline is not
always correct. i was wondering if there is a way to get a straight trendline
no matter the values are slightly a bit off, by just ignoring the ones which
dont fall under the "straight line category" ?? for instance, if the 3rd
value is slightly off, then ignoring just the 3rd??

if there is a way to do it through vba, and if you could show me a very
small example of the syntax or the code, or if it could be done in excel
itself, would be a great help as i am hoping to get my course work right..lol
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default straight line graph, really straight line..


Jason Wrote:
Hello, i am trying to add a trendline to graph which has 4 points and
is
supposed to be producing a straight line (but does not always), so due
to
these slight variations, the formula that i get from the trendline is
not
always correct. i was wondering if there is a way to get a straight
trendline
no matter the values are slightly a bit off, by just ignoring the ones
which
dont fall under the "straight line category" ?? for instance, if the
3rd
value is slightly off, then ignoring just the 3rd??

if there is a way to do it through vba, and if you could show me a
very
small example of the syntax or the code, or if it could be done in
excel
itself, would be a great help as i am hoping to get my course work
right..lol


A fairly simplistic way would be to calculate the slopes between all
sets of two points, then take the most common slope. Using this slope,
you'll need to find a suitable point on the line to get the equation of
the line you're looking for.

General Pseudocode:

For i = 1 to NumberOfPoints
For j = i+1 to NumberOfPoints
x = slope between i and j
Increase the count for slope x - some collection or other should do
this for you.
Next j
Next i

Go through your counts of slopes and determine the most common.

Find a point on the line.

Go through all the points to determine which points are on the line.

(Sorry, not 100% familiar with VB to the point where I could type out
the actual code for you.)

Scott


--
Maistrye
------------------------------------------------------------------------
Maistrye's Profile: http://www.excelforum.com/member.php...o&userid=36078
View this thread: http://www.excelforum.com/showthread...hreadid=563349

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 367
Default straight line graph, really straight line..

Hey, you have given me the idea and the code, thats more than enough for me
to tweak the knobs. if it doesnt work, i will bother you again after
searching the net. :), thanks very much..

"Maistrye" wrote:


Jason Wrote:
Hello, i am trying to add a trendline to graph which has 4 points and
is
supposed to be producing a straight line (but does not always), so due
to
these slight variations, the formula that i get from the trendline is
not
always correct. i was wondering if there is a way to get a straight
trendline
no matter the values are slightly a bit off, by just ignoring the ones
which
dont fall under the "straight line category" ?? for instance, if the
3rd
value is slightly off, then ignoring just the 3rd??

if there is a way to do it through vba, and if you could show me a
very
small example of the syntax or the code, or if it could be done in
excel
itself, would be a great help as i am hoping to get my course work
right..lol


A fairly simplistic way would be to calculate the slopes between all
sets of two points, then take the most common slope. Using this slope,
you'll need to find a suitable point on the line to get the equation of
the line you're looking for.

General Pseudocode:

For i = 1 to NumberOfPoints
For j = i+1 to NumberOfPoints
x = slope between i and j
Increase the count for slope x - some collection or other should do
this for you.
Next j
Next i

Go through your counts of slopes and determine the most common.

Find a point on the line.

Go through all the points to determine which points are on the line.

(Sorry, not 100% familiar with VB to the point where I could type out
the actual code for you.)

Scott


--
Maistrye
------------------------------------------------------------------------
Maistrye's Profile: http://www.excelforum.com/member.php...o&userid=36078
View this thread: http://www.excelforum.com/showthread...hreadid=563349


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
Line graph for cumulative number over time Jane Charts and Charting in Excel 0 April 9th 06 07:19 AM
x-y Line Graph question Mona Charts and Charting in Excel 3 February 2nd 06 12:37 AM
Line Graph Help mickeymouse Charts and Charting in Excel 2 January 27th 06 08:39 AM
Can you have a vertical line graph in Excel 2003 smithers2002 Charts and Charting in Excel 3 January 12th 05 01:27 PM
How do I "index" data in a line graph? ShirleyJL Charts and Charting in Excel 2 January 10th 05 10:06 PM


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