View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Daniel Bonallack Daniel Bonallack is offline
external usenet poster
 
Posts: 110
Default Excel trendline - get the R2 value by code

Thanks Mike

Does this mean that I can actually calculate the R2 on the workbook using a
formula?

Daniel


"Mike Middleton" wrote:

Daniel -

The trendline is based on Known Y's and Known X's.

So you could use the worksheet function RSQ to get the r-squared value.

For example,
=application.worksheetfunction.rsq(range(KnownY's) ,range(KnownX's))

- Mike
www.mikemiddleton.com

"Daniel Bonallack" wrote in
message ...
Hi, I have an Excel scatter chart, that has a trendline and R2 value.

How can I return the R-squared value of the trendline to a variable

I thought:
x = ActiveChart.SeriesCollection(1).Trendlines(1).Data label.Value

but this doesn't work.

Please help!
Thank you very much

Daniel