SLOPE Function (LibreOffice Calc)

Math Beginner LibreOffice Calc Introduced in LibreOffice 3.0
regression statistics data-analysis linear-modeling forecasting

The SLOPE function in LibreOffice Calc returns the slope of the linear regression line through a set of data points. This guide explains syntax, examples, regression logic, errors, and best practices.

Compatibility

â–¾

What the SLOPE Function Does â–¾

  • Calculates the slope of the regression line
  • Uses least-squares linear regression
  • Works with numeric X/Y pairs
  • Useful for forecasting, trend analysis, and modeling
  • Works across sheets

The regression line is:

y = m*x + b

SLOPE returns m.

Syntax â–¾

SLOPE(known_y; known_x)

Where:

  • known_y — dependent variable (Y values)
  • known_x — independent variable (X values)
X and Y ranges must be the same size.

Basic Examples â–¾

Slope of Y vs X

=SLOPE(B1:B10; A1:A10)

Slope across sheets

=SLOPE(Sheet1.B1:B50; Sheet2.A1:A50)

Slope using named ranges

=SLOPE(Sales; Months)

Slope with dates as X-values

=SLOPE(B1:B100; A1:A100)

(Calc automatically converts dates to serial numbers.)

Advanced Examples â–¾

Manual FORECAST equivalent using SLOPE + INTERCEPT

=SLOPE(B1:B10; A1:A10) * 11 + INTERCEPT(B1:B10; A1:A10)

Slope ignoring errors

=SLOPE(IF(ISNUMBER(B1:B10); B1:B10); A1:A10)

(Confirm with Ctrl+Shift+Enter in older Calc.)

Slope using filtered (visible) data only

Use SUBTOTAL helper column to filter X/Y before passing to SLOPE.

Slope after removing outliers

=SLOPE(FILTER(B1:B100; B1:B100<1000); FILTER(A1:A100; B1:B100<1000))

Slope for time-series forecasting

=SLOPE(Sales; Dates)

Slope for normalized data

=SLOPE((B1:B10 - AVERAGE(B1:B10)); (A1:A10 - AVERAGE(A1:A10)))

How SLOPE Calculates the Regression Coefficient â–¾

SLOPE uses the least-squares formula:

[ m = \frac{\text{COVAR}(x, y)}{\text{VAR}(x)} ]

Expanded:

[ m = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})}{\sum (x_i - \bar{x})^2} ]

Where:

  • ( \bar{x} ) = mean of X
  • ( \bar{y} ) = mean of Y

This is the same slope used by LINEST, TREND, and FORECAST.

Common Errors and Fixes â–¾

Err:502 — Invalid argument

Occurs when:

  • X and Y ranges have different sizes
  • Non-numeric text included
  • One of the ranges is empty

Err:504 — Parameter error

Occurs when:

  • Semicolons are incorrect
  • Range references malformed

SLOPE returns unexpected value

Possible causes:

  • Relationship is not linear
  • Outliers distort regression
  • X-values not aligned with Y-values
  • X-values have zero variance (all X are identical)

SLOPE differs from LINEST

They are identical — LINEST simply returns more statistics.

Best Practices â–¾

  • Use SLOPE when you need only the regression slope
  • Use INTERCEPT alongside SLOPE for manual predictions
  • Use TREND for multi-value forecasting
  • Use LINEST for full regression diagnostics
  • Remove outliers before modeling
  • Plot your data to confirm linearity
  • Use named ranges for cleaner formulas
SLOPE is the simplest way to extract the core behavior of a linear trend — perfect for quick modeling, forecasting, and exploratory analysis.

Copyright 2026. All rights reserved.