Function Problems

How to Calculate R-Squared for a Trendline in WPS Office Spreadsheets

Chanuka GeekiyanageChanuka Geekiyanage Nov 13, 2026 869 views

Question details

The user wants to know which function calculates the coefficient of determination, or R-squared value, for a set of known x and y values.

How to Calculate R-Squared for a Trendline in WPS Office Spreadsheets
Product
WPS Office Spreadsheets
Device & OS
not provided
Scenario
A user has known x and y values and wants to determine how closely the data fits a linear relationship.
Observed behavior
The user needs the correct function that returns the coefficient of determination, R-squared, for a linear trendline.
Before you start

Confirm that your x and y values are numeric and stored in equal-sized ranges or columns. This ensures the RSQ function returns a valid R-squared value.

Solution 1Recommended

Use the RSQ Function to Calculate R-Squared in WPS Office Spreadsheets

Use this method when you have known x and y values and need the coefficient of determination for a linear relationship without creating a chart.

The RSQ function returns the square of the Pearson product moment correlation coefficient. It is the standard spreadsheet function for R-squared when you already have separate x and y data ranges.

1
Select a result cell

Click an empty cell where you want the R-squared value to appear in your WPS Office Spreadsheets worksheet.

2
Enter the RSQ formula

Type =RSQ(known_y_values, known_x_values). For example, =RSQ(B2:B8,A2:A8) calculates the R-squared value using y-values in B2:B8 and x-values in A2:A8.

3
Press Enter and check the result

Press Enter to calculate. A result closer to 1 indicates a stronger linear relationship; a result closer to 0 indicates a weaker linear fit.

Use the RSQ Function to Calculate R-Squared in WPS Office Spreadsheets
Keep ranges the same length: The known_y and known_x ranges must contain the same number of numeric data points. You can also use full columns like =RSQ(B:B,A:A), but avoid extra text or blank cells that could affect the calculation.
WPS Office Spreadsheets

Calculate R-Squared with the RSQ Function in WPS Office Spreadsheets

Open your workbook in WPS Office Spreadsheets and enter the built-in RSQ function to calculate the coefficient of determination for a linear trendline. WPS Office reads and writes Microsoft Excel files, so the same formula works with .xlsx workbooks.

  1. 1. Open your workbook in WPS Office Spreadsheets: Launch WPS Office and open the workbook that contains your known x and y values.
  2. 2. Click the result cell: Select an empty cell where you want the R-squared value to appear.
  3. 3. Type the RSQ formula: Enter =RSQ(known_y_values, known_x_values), for example =RSQ(B2:B8,A2:A8).
  4. 4. Press Enter: Press Enter to calculate the coefficient of determination and display the result.
  5. 5. Interpret the result: A value closer to 1 means the linear trendline explains most of the variance; closer to 0 means it explains less.
Excel-compatible RSQ function for R-squaredFree spreadsheet formula calculation in WPS OfficeSupports .xlsx and .xls Microsoft Excel formatsLightweight and familiar Office-style interface
microsoft office alternative - wps office

Frequently Asked Questions

Which function calculates R-squared in WPS Office Spreadsheets?

Use the RSQ function. For example, =RSQ(B2:B8,A2:A8) returns the coefficient of determination for y-values in B2:B8 and x-values in A2:A8.

What are the arguments of the RSQ function?

The first argument is the range of known y-values, and the second argument is the range of known x-values. Both ranges must have the same number of data points.

Can I use whole columns in the RSQ formula?

Yes, you can use =RSQ(B:B,A:A), but make sure the columns contain only the relevant numeric data so unrelated entries do not affect the result.

What does an R-squared value close to 1 mean?

It means the linear trendline closely fits the known data; more of the variation in y is explained by x.

Does RSQ work for nonlinear trendlines?

RSQ is based on linear least-squares regression. For other trendlines, add a chart trendline in WPS Office Spreadsheets and display its R-squared label.