Wrong trendline equation

While writing a macro, I had collected some experimental data, but I needed an equation to include in the macro. No big deal.
So, I entered the data into a worksheet, created a chart, and added a trendline. I thought that by displaying the trendline equation, I would get the equation I needed.
That turned out not to be the case. The equation produced results that were way out of range. Completely meaningless.
What did I do wrong?
TrendlineEquation.ods (19.1 KB)

Version: 24.2.7.2 (X86_64) / LibreOffice Community
Build ID: 420(Build:2)
CPU threads: 2; OS: Linux 7.0; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 4:24.2.7-0ubuntu0.24.04.7
Calc: threaded
On Linux Mint 22.3 - Xfce 64-bit

Wrong Chart-type… use Type XY- (Scatter) instead!

try also:

9,11646586345382 =SLOPE(B2:B5;A2:A5)
3,17269076305222 =INTERCEPT(B2:B5;A2:A5)

or:

{=LINEST(B2:B5;A2:A5;1;1)}
9,11646586345382 3,17269076305222
0,106255072733518 1,22193333643545
0,999728382127544 1,45204467387879
7361,28571428572 2
15520,7831325301 4,21686746987951
1 Like

Excuse me for being a little too fast. I should have read the Calc Guide first :angry:.
There’s a note:
For chart types that use categories for the X axis, such as column, bar, or line charts,
the numbers 1, 2, 3… are used as values for calculating trend lines. By contrast, XY
(scatter) chart types show data rather than categories along the X axis. Thus, only
XY (scatter) chart types can show meaningful regression equations.
Now I know what I did wrong :smiley:
Sorry!

Help topic Trend Lines seems to offer a more polite description:

2 Likes