Contact

SLOPE Function (LibreOffice Calc)

Math Beginner LibreOffice Calc Introduction not established

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.

Verification status: Consult the documentation, examples and any stated test scope below. How formula examples are checked

Availability and version history

  • Introduced: Documented by LibreOffice 26.8.1.1; original introduction not established.
  • Availability: Supported in LibreOffice 26.8.1.1, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.
The **SLOPE** function returns the **slope (m)** of the best-fit linear regression line through a set of data points. It is one of the core building blocks of linear modeling in Calc and is used internally by FORECAST, TREND, and LINEST.

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.