RSQ function
Returns R², the share of the variation in y that a straight-line relationship with x explains (0 to 1).
Available in All versions of Excel, including Microsoft 365 and Excel for the web
In every Excel versionWorks in Google Sheets
Syntax
RSQ(known_y's, known_x's)| Argument | What it means | |
|---|---|---|
known_y's | Required | The dependent values (what you want to explain). |
known_x's | Required | The independent values, the same number of points. |
Returns: A number between 0 and 1.
How RSQ works
R-squared answers the question "how well does a straight line fit my data?". It is the share of the ups and downs in y that can be explained by x through a linear relationship. An R² of 0.9 means 90% of the variation in sales lines up with the variation in advertising spend; the remaining 10% is due to other factors or noise. An R² near 0 means a straight line is no better than simply predicting the average every time.
RSQ equals the square of PEARSON (or CORREL), and it matches the R² shown on a chart trendline and in row 3 of LINEST with statistics. A high R² does not prove that x causes y, and a low R² does not mean there is no relationship at all; it might simply be curved. Pairs containing text, logical values or blanks are ignored.
Examples
1How much of sales does ad spend explain?
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Ad spend (k) | Sales (k) | ||
| 2 | 2 | 41 | 0.9974 | |
| 3 | 4 | 52 | ||
| 4 | 5 | 58 | ||
| 5 | 7 | 70 | ||
| 6 | 9 | 79 |
Result: 0.9974
R² = 0.997422 (shown to 4 decimals): advertising spend accounts for over 99% of the variation in sales in this sample, a very tight linear fit.
2A weaker relationship
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Study hours | Exam score | ||
| 2 | 2 | 65 | 0.5852 | |
| 3 | 5 | 70 | ||
| 4 | 1 | 58 | ||
| 5 | 6 | 88 | ||
| 6 | 4 | 62 | ||
| 7 | 3 | 74 |
Result: 0.5852
R² = 0.585152 (shown to 4 decimals). Study time explains only about 59% of the differences in scores; other factors matter a lot.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#N/A | The two ranges have different numbers of points. | Use ranges of the same size. |
#DIV/0! | Only one data point, or one of the ranges has no variation. | Provide at least two different values in each range. |
Tips
- The argument order (y, x) does not change the result of RSQ, but keep it consistent with SLOPE and INTERCEPT to avoid confusion.
- For curved data, try
=RSQ(LN(y), x)to see how well an exponential model fits.
Google Sheets
RSQ also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
RSQ in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Czech | RKQ |
| Danish | FORKLARINGSGRAD |
| Dutch | R.KWADRAAT |
| Finnish | PEARSON.NELIÖ |
| French | COEFFICIENT.DETERMINATION |
| German | BESTIMMTHEITSMASS |
| Hungarian | RNÉGYZET |
| Italian | RQ |
| Norwegian (Bokmål) | RKVADRAT |
| Polish | R.KWADRAT |
| Portuguese (Brazil) | RQUAD |
| Portuguese (Portugal) | RQUAD |
| Russian | КВПИРСОН |
| Spanish | COEFICIENTE.R2 |
| Swedish | RKV |
| Turkish | RKARE |