Stock Returns. Probably the most fundamental and focal concept within investment analysis & portfolio management. How to calculate stock returns then? Perhaps more importantly, why should you calculate it that way?

**Table of Contents**hide

**TL;DR**

You can calculate the total stock return using this formula / equation:

Where reflects the return on a stock

refers to the Price at time , aka the price you sell the stock for; put differently, it’s “ending value”.

on the other hand reflects the Price at time , aka the price you *bought* the stock for. It’s the “beginning value”, if you like; or the initial investment, if you will.

This stock return formula holds regardless of whether you’re calculating the daily return, weekly return, monthly return, or annual return* depending on the data you’re working with*.

**If you’re working with daily data and want to calculate annualized return from daily returns, you can either:**

- multiply the daily return by 250 (the approximate number of days the stock market is open for in a year), or
- use where here reflects the daily return

**Now, to see why this equation works the way it does**, and to understand it inside out, read on.

You might want to grab a cup of tea though. This is probably the most in-depth explanation of how to calculate stock returns on “the internet”.

Just a quick note though – the equations in this article are best viewed on a laptop/desktop. Unfortunately, mobile phones don’t quite render the equations as well as desktops. We’re looking into technologically feasible solutions to overcome this issue.

If you haven’t seen our post on Investment Fundamentals: Price, Risk & Return, it’s worth reading that first.

But here’s a quick recap of the core point from that article:

‘Return’ refers to the amount of money that you make from your investment, expressed in percentage terms.

If you’d prefer to learn by video, here’s the related video:

Yes, we are on YouTube. No, we won’t ask you to “like”, “subscribe”, or click this button and that.

But people like you do seem to be subscribing to our channel increasingly 😉 – it’s great to have you all on board. We’re grateful.

Now, before we explore how to calculate stock returns, it’s important to get some fundamentals right.

Specifically, we want to know the difference between “profit” and “return”.

## Profits vs. Return

Imagine that you buy stock in Facebook for $160 and sell it for $192.73.

What is your profit and what is your return?

If you think about profit… profit shows you the amount of money that you earn from an investment. And it’s expressed in dollars or pounds or whichever currency you’re working with.

The return shows you *exactly the same information*, except that it’s expressed in percentage terms.

In this example, to get the profits, we would start with the selling price (the amount or the price at which we sold the stock) and take away the purchase price (the price at which we bought the stock).

And that gives you the profit. Note that in this context, profit is akin to “capital gains”, which is the difference between what you bought something for and what you sold it for.

We can annotate the Selling Price (or ending value) as and the Purchase Price (or beginning value) is .

So means this is the price at time plus one. And means that is the price of the stock at time .

And could be whatever you like. So it could be the date of purchase, or it could be the month of purchase, or it could be the quarter of purchase. It really depends on the frequencies that you are working with.

in our case was $192.73 and was $160. Take the difference between the two and you end up with a profit of $32.73.

To get the return, all we need to do is express the same $32.73 in percentage terms. And we do that by expressing it relative to the original investment of $160.

What does that look like? Well, the return of a stock is calculated as:

Remember again the is the Selling Price. is the Purchase Price. And then we’re scaling the difference between the two by the original price (i.e., the Purchase Price) to get the amount of money that you make, expressed in percentage terms.

In this example, is $192.73 and is $160. Take the difference between the two and divide it by (which is $160).

Now, because of the way the equation is written out, we can actually split it into two parts.

So I can take $192.73 and divide that by $160. And then subtract $160 divided by $160. So I can rewrite this equation like so:

And this then simplifies to $192.73 divided by $160, minus one (because anything divided by itself is always equal to 1).

When you solve for this, you’ll find that the return is 20.46%.

### Related Course: Investment Analysis and Portfolio Management Course

**This Article features a concept that is covered extensively in our Investment Analysis and Portfolio Management (with Excel®) Course.**

**If you’re interested in learning more about calculating stock returns (and portfolio returns) while working with real-world data, then you should definitely check out the course.**

## Generalized Return of a Stock

Let’s just look at calculating stock returns again. But this time, we’ll work with notations instead of numbers.

The return on a stock is:

This can be rewritten as:

Anything divided by itself is always equal to 1. And so this equation here can be rewritten like this:

And that’s pretty much it!

So when you think about how to calculate stock returns, the general equation can look like this:

Notice the subscript in .

could be anything – it could be Facebook or Alphabet (formerly Google) or Amazon or Netflix – whatever you like.

is just a generic term or generic notation for any stock.

So refers to the return on the stock .

You can calculate the return on a stock using either formula and you’ll end up at exactly the same result.

All right. Hopefully, this makes sense. If it’s not quite clear, please re-read this article up until here before continuing on.

## How to Calculate Stock Returns with Dividends

Let’s step it up now, and consider an example with dividends.

Imagine you buy 67 shares of Apple Incorporated at $149.04; you earn dividends of 63 cents per share for 4 quarters and then sell your shares for $191.03 each.

What is your profit and what is your return?

Before we crunch the numbers, there’s a fair bit of information here. So let’s just de-clutter make sure we understand what we’re working with.

We have the number of shares, which is not really relevant to calculate the return. But it is relevant to calculate the total profit (capital gains or capital appreciation) for instance.

That’s because your total profit is impacted by the number of shares that you own as well as the difference in the purchase price and selling price.

Then we have the purchase price which is $149.04.

And then we have information about dividends.

### What are Dividends?

Now, in case you’re not familiar with what dividends, they’re just a share of the profit that investors can get.

When you buy shares in a company, you technically own part of that company.

And that entitles you to earn this ‘dividend’, which is just a part of the profit that the company can pay out for you to keep.

This is just one of the rewards that you get for owning shares.

So in this example, you’re going to earn a dividend of 63 cents for every share that you own. And remember, you own 67 shares.

So you’re going to get 67 times sixty-three cents as your total dividends. And you’re earning this dividend every quarter, for four quarters. So you’re earning sixty-three cents four times in a year.

And then we’re saying that you sell your shares for $191.03. So that’s your selling price.

Let’s see how we can split the profit.

The profit now would be the selling price plus the dividends (because this is the total amount of money that you’re earning), and then you would subtract the purchase price (which is how much it costs you).

Using annotations again can make life easier. So the profit can be expressed as:

Strictly speaking, the notations should be more clear.

The notation implies that you get all of the dividends at time . In a sense, it suggests that this is an annual dividend.

But in reality, that’s not true. Because you’re getting dividends *every quarter*.

And so really, you would want to have:

But that just makes it unnecessarily complicated. And so to simplify things, and make life easier, we’ve just called it .

Plugging in our numbers then:

Note that the dividends are 63 cents *per share* *for four quarters*. Multiplying $0.63 by 4 gives us the total dividends for 1 share for 1 year.

## Do you want to explore investment analysis in more depth?

### Get the Investment Analysis & Portfolio Management (with Excel®) Study Pack (for FREE!).

Solve for that, and you’ll find that the profit is $44.51. That’s for 1 share though. If you want the total profit, you’ll want to incorporate the fact that you own 67 shares.

The total profit is therefore:

Let’s now look at how to calculate stock returns when we’re dealing with dividends.

It’s actually quite straightforward. We just change the equation for return a little bit and include this ‘dividend’ aspect. Our ‘modified’ return formula looks like this:

Plugging in our numbers into the return calculation looks like so:

Again, as before, if you were to split this into three parts like so:

Or even two parts, like so:

This then simplifies to this:

Note that .

And the 1 represents .

And finally, when you solve for this you’ll find that the return on Apple is 29.86%.

Great! You now know how to calculate stock returns both with and without dividends. How about we take things up a notch now?

## Generalized Return of a Stock with Dividends

Let’s just quickly look at how this equation works (using only notations this time).

The return of a dividend-paying stock is:

This can be rewritten as:

Which can then be simplified to:

Now that this is hopefully clear, we can come up with a general equation for the return of a stock :

Importantly, if you know this equation, then you don’t really need to know the previous equation that we looked.

That’s because we can just modify this new equation that we know and we’ll end up with a previous one anyway.

Say for instance you’re trying to calculate the return for a stock that doesn’t pay any dividends.

Well, then the will just be equal to zero.

And so the equation simplifies to:

Just a quick note. We know it’s tempting to call the dividends instead of , but we would strongly encourage you to write it out as and not .

That’s because we (as in people in Finance) tend to use to refer to debt.

And as you progress on in your journey to mastering finance, you’ll end up using the notation a lot more frequently (and you’ll use it to refer to the debt of a company).

To make your life easier then, and to avoid any confusion, we would strongly recommend that you work with as your own notation for dividends, instead of .

### Total Return vs. Dividend Yield

Now that you know how to calculate stock returns *with dividends*, we can think about “total return” vs. “dividend yield”.

Essentially, total return is made up of the dividend yield *and* capital gains (aka capital appreciation).

You already know how to calculate total return because we literally just applied it using this formula:

Earlier on, we defined this as the return of a dividend-paying stock.

Now, note that this formula can be rewritten as:

Alternatively, we could also write it out like this:

If we write it out this way, then we can literally see the formula for stock returns broken up into:

- capital gains (the first part of the formula), and
- dividend yield (the second part of the formula)

For clarity, we can explicitly say that the Dividend Yield (“DY”) is…

And the capital gains (or capital appreciation), dubbed “CG” is equal to…

Seeing it this way, we can say that…

Total Return = CG + DY

Or write the formula for total return mathematically as…

All right so hopefully this makes sense. If any part of this article is not clear so far, please read it again before moving on any further.

## How to Calculate Stock Returns on Excel®

Alright. Now that you know how to calculate stock returns manually, let’s look at how we can implement this on Excel®, using some real-world data.

### Accessing Financial Data

Getting access to financial data can be an expensive affair. But thankfully, we have free alternatives as well.

If you pop into Yahoo! Finance, let’s say we’re looking at Facebook. You just put in the ticker over here.

We want to get some data, so you can go into historical data right here and then set the time period.

We’re just going to go with the 1st of January 2012. Importantly, Facebook was not listed as a public company on the 1st of January 2012. They were listed later on in 2012, but it doesn’t matter because Yahoo! Finance will pull the data from the first day of trading.

So we don’t need to know the exact date and when they started trading. I’m just going to arbitrarily set the last date of data as the 31st of December 2017.

You can choose any other time frame that you like. But if you want to work with us in this then maybe work with the same dates just to make life easier.

Go ahead and click done then and then make sure to hit ‘Apply’.

And then you want to download your data which will come out as a CSV file.

### Extracting Relevant Data

Here’s the data that we’re looking at. There’s quite a lot of things going on here but let’s just see what the information is.

We’ve got the **Date**, which is the date of trading.

Then we’ve got **Open**, which is the price at which the stock opened.

Next, we’ve got **High**, which is the high point of the day – so that’s the highest price at which the stock traded at on the day.

**Low** is the lowest point of the stock – so it’s the lowest price at which the stock traded at on the day.

**Close** is what the stock closed at.

And **Adjusted Close** (aka Adjusted Closing Price) is pretty much the same as Close, except that it will also adjust for dividends.

When companies pay out dividends, the stock price actually decreases. And so the Adjusted Closing Price will factor in that change in price as a result of the dividends.

It will also incorporate effects for things like stock splits, and stock bonuses, for example.

**Volume** is just the number of trades that took place on the day.

For the purpose of what we’re trying to do here – to calculate stock returns – we don’t actually need all of this information.

We only really need the Date and Adjusted Close columns so we’re going to keep just those 2. And rename “Adjusted Close” to “Price” (see below).

### Calculating Stock Returns on Excel

Now we can calculate returns, daily.

Recall that return is:

In this case, is the price on the 21st of May 2012. And is the price on the 18th of May 2012. Apply the formula on Excel® like this:

We can see that the return there is -10.99\% or approximately -11 percent (see pic below).

And then you want to do exactly the same thing for all of these prices.

All you need to do is double click the corner of the cell (where you see the little green square in the bottom right corner of cell C3) and Excel® will magically calculate all of your daily returns.

And that’s pretty much it!

Okay, let’s now consider how to calculate stock returns on Python.

## How to Calculate Stock Returns on Python

Calculating stock returns on Python is actually incredibly straightforward.

You could either:

- calculate stock returns “manually”, by using the .shift() method to stack the stock price data so that and share the same index, or
- by using the .pct_change() method that’s built into Pandas

We showcase both methods in great detail in our popular video on Calculating Stock Returns on Python (Code-along), viewable here:

*Video playback issues? Watch it here instead.*

**Here are the timestamps for the video:**

- 00:00 – Introduction
- 00:18 – Return of a stock formula
- 01:45 – Importing package dependencies
- 02:42 – Importing the data (reading a csv)
- 04:19 – Exploring & filtering the data
- 05:35 – Cleaning the data
- 06:50 – Calculating Stock Returns on Python
- 13:00 – Exploring Stock Prices & Stock Returns
- 16:14 – Returns vs. Expected Returns
- 16:55 – Approaches for Estimating Expected Returns
- 17:28 – Summary

Importantly, while the video doesn’t explicitly say so, you want to **make sure that there are no missing observations when you apply the pct_change() method**.

If you have missing observations in your daily stock price data, use .pct_change(1, fill_method=None) to calculate stock returns on Python.

Incidentally, this video is part of our course on Investment Analysis & Portfolio Management (with Python) so do check that out if you’re interested in learning how to leverage the power of Python for investment analysis.

## Wrapping Up

You now know how to calculate stock returns. Actually, you know more than that including:

- The different ways of expressing the stock return formula, both with and without dividends.
- How to calculate stock returns manually.
- Accessing data for free from Yahoo! Finance
- Extracting relevant data for to calculate stock returns with real-world data.
- Using Excel® to make your life easier by quickly calculating stock returns for daily returns in one go
- Using Python to make your life even easier by calculating stock returns with a single line of code!

**Next Steps**

Now that you know how to calculate stock returns, why not take the next step and explore the other side of the coin?

We’re talking about the risk of a stock of course! Learn how to measure the risk of a stock in our sister article (hint: it’s the standard deviation of a stock!).

We also recommend reading:

Better yet, if you’re genuinely serious about taking your investment analysis skills to the next level, check out the course below.

### Related Course: Investment Analysis & Portfolio Management (with Excel®)

**Do you want to leverage the power of Excel® and learn how to rigorously analyse investments and manage portfolios?**

## Leave a Reply

You must be logged in to post a comment.