Contact

ONLYOFFICE RSQ: Squared Correlation and Regression Fit Explained

Statistical Intermediate ONLYOFFICE

Calculate squared correlation in ONLYOFFICE, rebuild R-squared from fitted residuals and distinguish fit from direction or prediction accuracy.

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

Quick answer: =RSQ(B2:B6,A2:A6) returns the square of Pearson’s correlation coefficient. For x 1, 2, 3, 4, 5 and y 2, 4, 5, 4, 5, the independent expected result is 0.6. The square removes the direction of the relationship.

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 RSQ reference. Examples were independently calculated and compared with the vendor screenshot; these cases were not tested in the native application.

Syntax and argument order

=RSQ(known_y's, known_x's)

The placeholders mean the dependent y range first and the independent x range second. Replace them with actual ranges; do not type apostrophes around cell references. Both arguments are required.

The official RSQ reference defines the result as the square of the Pearson product-moment correlation coefficient. It requires equal element counts and says text, logical values and empty cells are ignored, while zeros are included. Keep paired observations aligned.

For ordinary simple least-squares regression with an intercept and nonconstant x and y, this equals the proportion of centered y variation explained by that fitted line. That interpretation does not automatically transfer to a model forced through zero, an unrelated prediction model or an out-of-sample score.

A complete regression check

Create a blank sheet named FitCheck. Put x, Actual y, Fitted y, Residual, Squared residual and Squared deviation from y mean in A1:F1. Enter A2:B6:

Row A: x B: Actual y Expected C Expected D Expected E Expected F
2 1 2 2.8 -0.8 0.64 4
3 2 4 3.4 0.6 0.36 0
4 3 5 4.0 1.0 1.00 1
5 4 4 4.6 -0.6 0.36 0
6 5 5 5.2 -0.2 0.04 1

Use these summary cells:

Cell Formula Expected result
H2 =SLOPE(B2:B6,A2:A6) 0.6
H3 =AVERAGE(B2:B6)-H2*AVERAGE(A2:A6) 2.2
H4 =AVERAGE(B2:B6) 4
H6 =RSQ(B2:B6,A2:A6) 0.6
H7 =PEARSON(A2:A6,B2:B6)^2 0.6

The fitted line is y=2.2+0.6x. Enter C2 =$H$3+$H$2*A2, D2 =B2-C2, E2 =D2^2 and F2 =(B2-$H$4)^2. Fill C2:F2 through row 6.

In H9 enter =SUM(E2:E6); expect 2.4, the residual square sum. In H10 enter =SUM(F2:F6); expect 6, the total centered square sum. In H11 enter =1-H9/H10; expect 0.6, matching RSQ.

For this fitted-intercept model, the residual variation is 40% of the original centered variation, leaving 60% explained by the fitted line. This does not mean that 60% of individual predictions are correct or that future predictions have a 60% success probability.

Advanced: a negative relationship can also have RSQ=1

Create a separate sheet named Direction. Put x, Rising y and Falling y in A1:C1. Enter 1, 2, 3, 4, 5 in A2:A6. In B2 enter =2*A2+1; in C2 enter =20-3*A2; fill B2:C2 through row 6.

The B values are 3, 5, 7, 9, 11 and C values are 17, 14, 11, 8, 5. Put =RSQ(B2:B6,A2:A6) in E2 and =RSQ(C2:C6,A2:A6) in E3. Both expected results are 1.

Put =PEARSON(A2:A6,B2:B6) in F2 and =PEARSON(A2:A6,C2:C6) in F3. Expect 1 and −1. Reporting only RSQ would conceal the opposite directions. Retain the signed coefficient or slope when direction matters.

Reproduce the vendor screenshot

On another blank sheet, enter these values in A1:D4 without headers:

A B C D
1 0 0 0
0 1 0 0
2 3 4 5
6 8 10 12

In D5 enter =RSQ(A1:B4,C1:D4). Independent arithmetic gives approximately 0.9654321535, agreeing with the official screenshot’s 0.9654322. There are eight paired observations, including numeric zeros. The squared-correlation calculation is exactly 609961/631801 in rational arithmetic for this dataset.

Errors and interpretation limits

The centered-square denominator vanishes when a series is constant. The official page does not enumerate exact native errors for this, too few usable pairs, mismatched ranges or cell errors. Use complete numeric data and investigate exceptions in the target editor.

A high value does not prove causation, remove outliers or justify extrapolation. A low value does not exclude a curved relationship. Check the residuals and the original points rather than treating one statistic as a complete quality test.

Use PEARSON or CORREL to retain direction. SLOPE supplies the fitted change per unit x, and AVERAGE provides the means in the intercept and residual checks.