Contact

ONLYOFFICE SLOPE: Fit a Line, Check Residuals and Preserve Units

Statistical Intermediate ONLYOFFICE

Fit a straight-line slope in ONLYOFFICE with full data, intercept and residual checks, unit conversions and clear argument-order examples.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: =SLOPE(B2:B6,A2:A6) fits the change in y per unit of x. With x 1, 2, 3, 4, 5 and y 2, 4, 5, 4, 5, its independent expected result is 0.6. Put the dependent y range first.

Availability and version history

  • Introduced: The first introduction release and date are not established by the checked sources.
  • Availability: Currently documented in ONLYOFFICE’s rolling function help; no final supported-version endpoint is established.
  • Scope: Shared Spreadsheet Editor documentation. Exact availability in individual Docs, Desktop and mobile builds is not established by this page.
  • Checked: October 14, 2026, against the official SLOPE reference. Examples were independently calculated and compared with the vendor screenshot; these cases were not tested in the native application.

Syntax and units

=SLOPE(known_y's, known_x's)

The official SLOPE reference describes the slope of a linear regression line. Both ranges are required and must contain the same number of elements. Text, logical values and empty cells are ignored; numeric zeros are included.

The first range supplies y, the quantity being modeled. The second supplies x, the explanatory quantity. For complete numeric pairs, the ordinary least-squares slope is the centered x×y product sum divided by the centered x-square sum. Its units are y-units per x-unit.

SLOPE returns the slope alone. It does not return the intercept, predicted values, confidence intervals or evidence of causation. The worksheet below calculates the intercept separately so that the fitted line is complete.

Build and inspect a fitted line

Create a blank sheet named LinearFit. Put x, y, x deviation, y deviation, Product and x squared deviation in A1:F1. Enter A2:B6 from this table:

Row A: x B: y Expected C Expected D Expected E Expected F
2 1 2 -2 -2 4 4
3 2 4 -1 0 0 1
4 3 5 0 1 0 0
5 4 4 1 0 0 1
6 5 5 2 1 2 4

Enter =AVERAGE(A2:A6) in H2 and =AVERAGE(B2:B6) in H3. Expect 3 and 4. Enter C2 =A2-$H$2, D2 =B2-$H$3, E2 =C2*D2 and F2 =C2^2. Fill C2:F2 through row 6.

In H5 enter =SUM(E2:E6) and in H6 =SUM(F2:F6); expect 6 and 10. Put =SLOPE(B2:B6,A2:A6) in H8 and =H5/H6 in H9. Both expected results are 0.6.

In H10 enter =H3-H8*H2; expect the intercept 2.2. This gives the fitted line y=2.2+0.6x. The official INTERCEPT reference documents the corresponding dedicated function, but the mean-based formula above shows how the intercept is obtained.

Predictions and residuals without overwriting inputs

Still on LinearFit, put Fitted y, Residual and Squared residual in J1:L1. In J2 enter =$H$10+$H$8*A2, in K2 =B2-J2 and in L2 =K2^2. Fill J2:L2 through row 6.

Row Expected J Expected K Expected L
2 2.8 -0.8 0.64
3 3.4 0.6 0.36
4 4.0 1.0 1.00
5 4.6 -0.6 0.36
6 5.2 -0.2 0.04

Put =SUM(K2:K6) in K8; its mathematical target is 0. Put =SUM(L2:L6) in L8; expect 2.4. Preserve stored precision when checking these identities, allowing for floating-point differences.

In N2 enter 6, then =$H$10+$H$8*N2 in O2. The line predicts 5.8. This x lies outside the observed range 1–5, so it is an extrapolation. The formula can compute it without establishing that the relationship continues beyond the data.

Advanced: reversing or rescaling the variables

Keep LinearFit unchanged. On a separate sheet named Units, enter the same five x/y pairs in A2:B6. In C2 enter =1000*B2 and fill to C6. Use:

Cell Formula Independently expected result
E2 =SLOPE(B2:B6,A2:A6) 0.6
E3 =SLOPE(C2:C6,A2:A6) 600
E4 =SLOPE(A2:A6,B2:B6) 1

Scaling y by 1000 scales the slope by 1000. Reversing x and y fits a different regression: its slope is 1, not the reciprocal 1/0.6. For these data the product of the forward and reverse slopes is 0.6, equal to the squared correlation. A perfect nonconstant linear relationship is the special case in which the two fitted slopes are reciprocals.

Reproduce the official example

On another blank sheet, enter the rows 1,0,0,0, 0,1,0,0, 2,3,4,5 and 6,8,10,12 into A1:D4 without headers. Put =SLOPE(A1:B4,C1:D4) in D5.

The centered product sum is 781/8 and the x-square sum is 1319/8, giving slope 781/1319, approximately 0.5921152388. This agrees with the official screenshot’s 0.5921152. The two rectangular ranges each contain eight paired cells, including zeros.

Errors and practical limits

A constant x series has no x variation, so the ordinary slope formula has a zero denominator. The short ONLYOFFICE page does not specify every native error for constant, insufficient, mismatched or erroneous data. Do not assume another spreadsheet’s precise error behavior.

Preserve pair alignment, inspect outliers and keep measurement units consistent. SLOPE does not infer time spacing from row positions: if x means elapsed days, enter the actual day values. This is an unweighted straight-line model with a fitted intercept; a forced-zero or weighted model is a different calculation.

CORREL reports dimensionless association. RSQ summarizes squared correlation, while SUM and AVERAGE expose the components of the fitted-line check.