# How to calculate a mixed interest rate?

I would like to calculate the realized interest rate of my stocks. How can I do that?

Example:

I buy stock A for 1000\$ in year 1. After 3 years it is worth 1158\$ (+5%/a, 158\$ profit)

I buy stock B for 500\$ in year 2. After 2 years it is worth 530\$ (+3%/a, 30\$ profit)

My total profit in year 4 is 188\$ which corresponds to roughly +4.5%/a on average. I would like to know how I could calculate the 4.5% instead of using trial and error.

• You should have the value of your stocks at any day (any end of year period). Where exactly is the trial and error in this calculation? Commented May 27 at 21:39
• You can set this up in a spreadsheet or you can use a CAGR calculator. Commented May 27 at 21:46
• As mentioned, IRR, is what you need. If you don't want to calculate it by hand, here is an IRR calculator (which I created).
– Karl
Commented May 28 at 10:53
• @AKdemy The trial and error was getting the 4.5% without knowing the formula to calculate it. Commented May 28 at 18:43

In the absence of intermediate valuations use the internal rate of return calculation which only requires cash flows.

https://en.wikipedia.org/wiki/Rate_of_return#Internal_rate_of_return

$NPV=\sum_{t=0}^{n}\frac{C_{t}}{(1+r)^{t}}=0$

equating the cash flows

$\therefore NPV=\frac{1000}{(1+r)^{0}}+\frac{500}{(1+r)^{1}}-\frac{1158+530}{(1+r)^{3}}=0$

solve for r

$\therefore r=4.519%$

Using Excel

• In case someone else has a similar question in the future: If the data points are not all at the end of a year but rather distributed over irregular time steps, the Excel-formula is XIRR instead of IRR. Commented May 28 at 18:47
• And Excel will use an algorithm that can be termed as trial and error. It's a goal seek problem in the end and there are well known quick convergion methods. But in most cases there is no closed formula solution. Commented May 28 at 18:59