Help with Trendline

jonny1984

New Member
Joined
Apr 27, 2012
Messages
20
Office Version
  1. 2016
Platform
  1. Windows
Hi all

Tearing my heair out all afternoon with this .....

I have a table of data which I am using a chart and then I want to use the trendline equation from the chart (polynomial formula) - in other cells.

I am using the INDEX / LINEST function .... but the function is giving me different coefficients from the ones listed on the chart in the trendline !!!!!!

Have uploaded the sheet to show what I am trying to achieve - I've gone over it 1000 times looking for mistakes but can't find any !! If anyone else could help it would be most gratefully appreciated !!

Excel file here
https://www.dropbox.com/s/xt6epglrcv6shh6/Book4.xlsx?dl=0

Thanks!
Jonny
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
For whatever reason, charts and LINEST use different algorithms for regression. I expect they will converge at some point.

Using INDEX, you are requiring that the regression be performed repeatedly for each coefficient, which is computer abuse. You can get all in one go with additional stats, ...

B​
C​
D​
E​
F​
26​
0.0002281​
0.018689​
0.433862​
B26:D30: {=LINEST(C3:C21, B3:B21^{1,2},,TRUE)}
27​
0.0001002​
0.001497​
0.03612​
28​
0.9069757​
0.105011​
#N/A​
29​
77.999067​
16​
#N/A​
30​
1.7202441​
0.176437​
#N/A​

(The green cell is R2)

Or all in one go with just the coefficients:

B​
C​
D​
E​
F​
32​
0.0002281​
0.018689​
0.433862​
B32:D32: {=LINEST(C3:C21, B3:B21^{1,2})}
 
Last edited:
Upvote 0
For whatever reason, charts and LINEST use different algorithms for regression. I expect they will converge at some point.

Using INDEX, you are requiring that the regression be performed repeatedly for each coefficient, which is computer abuse. You can get all in one go with additional stats, ...

B​
C​
D​
E​
F​
26​
0.0002281​
0.018689​
0.433862​
B26:D30: {=LINEST(C3:C21, B3:B21^{1,2},,TRUE)}
27​
0.0001002​
0.001497​
0.03612​
28​
0.9069757​
0.105011​
#N/A​
29​
77.999067​
16​
#N/A​
30​
1.7202441​
0.176437​
#N/A​

<tbody>
</tbody>


(The green cell is R2)

Or all in one go with just the coefficients:

B​
C​
D​
E​
F​
32​
0.0002281​
0.018689​
0.433862​
B32:D32: {=LINEST(C3:C21, B3:B21^{1,2})}

<tbody>
</tbody>




Hi shg

Thanks for the advice -

Noted re removing INDEX - have changed to use your formulas

Noted re different algorithms - but then I would have 2 furhter questions....

(1) How can the algorithms be so different ?? The "intercept" (b) in the formula on the graph is 0.0715 - which also looks to be correct, this is where the trendline bisects the y-axis. However, the intercept in the formula is 0.434 !!! This is obviously very different from 0.0715 (43% vs 7% on a y-axis chart) - and it also looks to be a completely random number ! This makes me think something has gone wrong .

(2) If it hasn't gone wrong and this is genuinely the result of another algorithm's estimation - is there any way to retrieve the numbers from the trendline chart.. i.e. is there any other formula? Or what calculation is excel doing to calculate these coefficients for the formula on the chart ?


Thanks in advance
Jonny
 
Upvote 0
There's no need to quote my posts back to me.

They are two different fits, and R2 is similar for both.

I recollect Andy Pope has some code to retrieve the coefficients from the trendline equation; you'd need to track it down: http://andypope.info/
 
Last edited:
Upvote 0
D'oh.

Your chart is a line chart, which means the x axis is treated as categorical {1,2,3,...}.

Change it to x-y scatter.
 
Upvote 0

Forum statistics

Threads
1,214,620
Messages
6,120,559
Members
448,970
Latest member
kennimack

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top