How to Calculate CAPM Beta in Excel: 3 Quick Methods

Method 1 – Calculating CAPM Beta Using Excel Formula

  • Prepare a dataset containing Portfolio Returns (standard returns) and Market Returns data.

Dataset for calculating capm beta

  • Apply the following formula to Portfolio Beta (CAPM Beta).
=COVARIANCE.P(C5:C14,D5:D14)/VAR.P(C5:C14)

Calculating beta with capm formula

We determined the variance of data from range C5:C14 with the VAR.P function and divided the covariance output by the variance output to obtain the CAPM beta.


Method 2 – Applying the Analysis ToolPak to Calculate CAPM Beta

  • Select the Data tab and go to Data Analysis.

Opening data analysis toolpak for beta calculation

  • Select the Regression option from the Data Analysis tab.

Selecting regression from data analysis

  • From the Regression tab, enter the reference range for data of Portfolio Returns and Market Returns in the Input Y Range and Input X Range sections, respectively. Select the range for output in the Output Range section.

Setting up regression

  • After pressing OK, you will see the various analysis results in the worksheet. CAPM Beta is one of them.

Calculated beta using analysis toolpak


Method 3 – Use Excel VBA to Calculate CAPM Beta

  • Open the VBA window by pressing Alt + F11. You can also select the Developer tab > Visual Basic.
  • Select Insert > Module to open a new code module.

Opening new vba module

  • Use the attached code in the module and run it.

Code:

Sub Beta_VBA()
Dim P_Returns As Range
Dim M_Returns As Range
Dim Covariance As Double
Dim Variance As Double
Dim Beta As Double
Set P_Returns = Worksheets("Beta_VBA").Range("C5:C14")
Set M_Returns = Worksheets("Beta_VBA").Range("D5:D14")
Covariance = WorksheetFunction.Covariance_P(P_Returns, M_Returns)
Variance = WorksheetFunction.Var_P(P_Returns)
Beta = Covariance / Variance
Worksheets("Beta_VBA").Range("F5") = Beta
End Sub

Vba code to calculate capm beta

  • You will the find the CAPM Beta in the worksheet.

Valculated beta with vba

Code Breakdown:

  • We declared a sub-procedure and defined some necessary variables.
  • We defined two ranges P_Returns and M_Returns as input ranges.
  • We used the VBA Covariance_P function to get the covariance of data from ranges C5:C14 and D5:D14. We also used the VBA Var_P to get the variance of data from range C5:C14.
  • We divided the covariance result by the variance result to get beta. We printed the result in the worksheet.

How to Use CAPM Beta to Get the Expected Return

We will use the following CAPM formula:

r = Rf + β * (Rm - Rf) 

  • r is expected return
  • Rf is the risk-free rate
  • β is the capm beta
  • Rm is the expected market return (average).

Follow the steps to get Expected Return:

  • We need to determine the average of the data from Market Returns:

=AVERAGE(D5:D14)

Determining average of market returns

The AVERAGE function finds the average of data from the range D5:D14.

  • Define a Risk-Free Rate for the calculation. We have taken 1.5% as a risk-free rate.
  • Calculate the beta as we did before.
  • Apply the following formula in a cell to calculate the Expected Return there.
=F5+F8*(D15-F5)

F5, F8, and D15 cells are risk-free rate, portfolio beta, and average market returns, respectively.

Calculated expected return using capm


Frequently Asked Questions

How do we interpret beta values?

A beta of 1 indicates that an investment’s returns move in line with the standard returns, while a beta greater than 1 indicates that the investment is more volatile than the standard, and a beta less than 1 indicates that the investment is less volatile than the standard.

Can beta change over time?

Yes, beta can change over time due to changes in market conditions, company performance, and other factors. Investors should regularly reassess their holdings and adjust their portfolios as necessary to maintain their desired level of risk.


Things to Remember

  • Be careful while dealing with cell references in the formula. In some cases, we used absolute cell references with the “$” sign.
  • Change the Risk-Free Rate according to your needs.
  • Don’t forget to save the file as an .xlsm file before running VBA macro.

Download the Practice Workbook


Related Articles


<< Go Back to Stocks In Excel| Excel for Finance | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mehedi Hasan Shimul
Mehedi Hasan Shimul

Md. Mehedi Hasan, with a BSc in Electrical & Electronic Engineering from Bangladesh University of Engineering and Technology, holds a crucial position as an Excel & VBA Content Developer at ExcelDemy. Driven by a deep passion for research and innovation, he actively immerses himself in Excel. In his role, Mehedi not only skillfully addresses complex challenges but also exhibits enthusiasm and expertise in gracefully navigating tough situations, emphasizing his steadfast commitment to consistently deliver exceptional and quality content.... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo