RSQ Function

Excel Functions › Statistical

All versions Statistical

The Excel RSQ function returns the square of the Pearson correlation coefficient (R²) for two data sets — the proportion of variance in the y-values explained by the x-values in a linear fit.


Quick answer:
=RSQ({2,3,9,1,8},{6,5,11,7,5}) R-squared of the two sets =~ 0.2089

Syntax

=RSQ(known_ys, known_xs)
ArgumentDescription
known_ysRequiredThe array or range of dependent (y) data points.
known_xsRequiredThe array or range of independent (x) data points. Must have the same count as known_ys.

How to use it

RSQ measures how well a straight line fits two paired data sets. The result ranges from 0 (no linear relationship) to 1 (a perfect line). It is literally the square of what CORREL returns.

=RSQ({1,2,3,4,5},{2,4,6,8,10}) // perfect line = 1
=RSQ({2,3,9,1,8},{6,5,11,7,5}) // weak relationship =~ 0.2089

Because R² is the square of the correlation, =RSQ(...) equals =CORREL(...)^2 for the same data. The two arrays must contain the same number of points.

Reading R²: an R² of 0.81 means about 81% of the variation in y is explained by the linear relationship with x. The remaining 19% comes from other factors or noise.

Try it: interactive demo

Live demo

Pick a RSQ example to see the formula and its result.

Result:

Practice workbook

📊
Download the free RSQ practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What does RSQ actually measure?
It returns R², the fraction of the variance in the y-values that is explained by a linear fit against the x-values. Values run from 0 (no linear fit) to 1 (perfect line).
How is RSQ related to CORREL?
R² is the square of the Pearson correlation, so =RSQ(ys,xs) equals =CORREL(ys,xs)^2 for the same data.
Does the order of arguments matter?
For RSQ specifically the result is the same either way, because squaring removes the sign. But by convention put known_ys first and known_xs second to stay consistent with SLOPE and INTERCEPT.
What if the arrays are different sizes?
RSQ returns an N/A error. The two arrays must contain the same number of numeric points; empty cells, text, and logical values are ignored in pairs.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: SLOPE · INTERCEPT · CORREL · PEARSON · STEYX