 # How to get the equation of a trend line in Calc?

Suppose I have a (xy scatter) diagram in localc and insert a trend line, for example a linear one of the type `f(x) = ax + b`. I know hot to display the equation in the diagram, but how can I reference to the parameters `a` and `b` in a cell to make further calculations with it?

@karolus: LO Calc Oh, in ubuntu libreoffice calc can be started using the command localc

@student - As you know how to display the trend line equation just look at the equation and take the parameters you need. The parameters have a high number of digits thus the result should be sufficiently precise.

Due to complexity reasons I feel the the equations @karolus indicates are only available for linear trend lines.

An enhancement request to copy the parameters from trend line equations appears to me as a very interesting one.

@ROSt53. I found a good solution to the problem link. I also filed a bug.

A less-than-convenient workaround:

Copy the equation in the chart to clipboard.

Start a new OO Draw window: File > New > Drawing

Paste the equation

Select the equation and right-click > Break

Now you can click into the text and copy/paste it as plain text anywhere you like.

It really work, thank you!

This is great. Only one detail: when copying the equation after braking it, note that any minus sign in the equation is taken as hifen. Jorge

To extract the trend line data from a series of `x` an `y` values, you can use the LINEST function. This function returns the values for s and b from your equation above. It can also return other tests such as the r squared value.

Because LINEST returns multiple results, it must be entered as an array formula. You do this by pressing Ctrl+Shift+Enter when you finish entering the formula. The results are returned to multiple cells. Approximately 2 columns wide by 5 rows high.

LINEST takes 4 arguments. 1 a list of Y-Values, 2 a list of x-values, 3 enter TRUE to force the vertical axis intercept to 0 or false for it to be calculated. 4. Enter TRUE to return regression statistics and FALSE to only return the values for `a` and `b`.

let us know if you have any questions.

Cheers,

John