How do I calculate R2 coefficient using a formula?

In the case of simple linear regression when R2 is calculated as the square of the simple correlation coefficient, the formula can be written as:

Pow(Correlation(fx:s2, fx:s1), 2)

Where fx:s2 is the dependent series and fx:s1 is the explanatory series.

For more information, please check:

Regression analysis

Regression line