# Calculating 2 x r squared values

#### JeffGrant

##### Board Regular
Hi All,

I have two trend lines generated from the same data. As you can in the chart, the polynomial trend line creates an R squared value of 1. The linear regression trendline creates an R squared value of 0.148.

My data set is

 X Y 57.5​ 16.56​ 52​ 16.34​ 54​ 16.76​

Using LINEST(B2:B4,A2:A4^{1,2}), I can get the co-efficients of the polynomial.
Using LINEST(B2:B4,A2:A4), I can get the slope and intercept of the linear trend line.
Using RSQ(B2:B4,A2:A4), I can get the R-Squared value of the linear trend line

How can I get the R-Squared value of the polynomial from the same dataset?

I have tried a few alternative methods to calculate the R Squared and it always calculates the values for the Linear Trend line, not the polynomial.

I really would like to have both R-Squared values in the same sheet, so the I can switch formulas as the data changes.

### Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

##### Well-known Member
Try this:
Book1
ABCDEFGH
1XY
257.516.56
35216.34
45416.761
5
6
Sheet3
Cell Formulas
RangeFormula
E4E4=INDEX(LINEST(B2:B4,A2:A4^{1,2},TRUE,TRUE),3,1)

To get R-squared as a cell value for different types of trendlines:

Linear
Excel Formula:
``=RSQ(known_ys, known_xs)``
Power
Excel Formula:
``=RSQ(LN(known_ys), LN(known_xs))``
Logarithmic
Excel Formula:
``=RSQ(LN(known_ys), known_xs)``
Exponential
Excel Formula:
``=RSQ(known_ys,LN(known_xs))``
Polynomial (2nd degree)
Excel Formula:
``=INDEX(LINEST(known_ys,known_xs^{1,2},TRUE,TRUE),3,1)``
Polynomial (3rd degree)
Excel Formula:
``=INDEX(LINEST(known_ys,known_xs^{1,2,3},TRUE,TRUE),3,1)``

#### JeffGrant

##### Well-known Member
You're Welcome & Thanks for Feedback.

Replies
3
Views
128
Replies
2
Views
261
Replies
2
Views
236
Replies
0
Views
219
Replies
2
Views
285

1,148,237
Messages
5,745,555
Members
423,959
Latest member
Bismarkmensah

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back