How to Calculate Historical Volatility in Excel

This page is a detailed guide to calculating historical volatility in Excel.

Things Needed for Calculating HV in Excel

Excel Functions Used for HV Calculation

Historical volatility calculation is not that complicated. We will only need the following Excel functions:

Don’t worry if you are not familiar with some of them. That’s what this page is for. Besides these functions it is only the very basics – multiplication, division, copying formulas etc.

So let’s get started. We’ll start from scratch – just open a new blank Excel worksheet.

Step 1: Put Historical Data in Spreadsheet

Historical volatility is calculated from daily historical closing prices. Therefore the first step is to put historical prices in our spreadsheet.

In this example I will be calculating historical volatility for Microsoft stock (symbol MSFT), using Yahoo Finance data from 31 August 2015 to 26 August 2016. If you don’t have data, want to use Yahoo Finance and don’t know how to find and download data from there, I’ve done a detailed guide for that here (using the same MSFT example).

We will put the data in columns A (date) and B (closing price). Use row 1 for header, so we know which column does what later when we add more columns.

Excel historical data header

If your security pays dividends or has history of stock splits or other actions affecting its price, it is better to use historical closing prices adjusted for these – usually called Adjusted Close – otherwise you will get misleading numbers. So this is also what I will do with Microsoft stock.

Paste the data in rows 2 and below.

Preparing historical data in Excel

Now you should have historical data ready in columns A and B and you can start the actual historical volatility calculation.

Step 2: Calculate Logarithmic Returns

Historical volatility (at least the most common calculation method which we are doing here) is calculated as standard deviation of logarithmic returns. Therefore we first need to calculate these logarithmic returns (also called continuously compounded returns) for every day (row) – we will do this in column C.

It is very simple: daily logarithmic return is the natural logarithm (ln) of the ratio of closing price and the closing price the day before. Mathematically:

Daily logarithmic return formula

In Excel we will use the LN function, which has only one argument – the number x for which we want to find the natural logarithm ln(x). In our case the x is the ratio of closing prices. Therefore, the formula in cell C3 will be:


where cell B3 is the current day’s closing price and cell B2 the previous day’s closing price.

Calculating logarithmic returns

Copy the formula to the rest of column C. The return can’t be calculated for the first day, because we don’t know the previous day’s closing price, so we keep cell C2 empty.

Calculating logarithmic returns

We have now calculated daily logarithmic returns.

Step 3: Calculate Standard Deviation

The next step is to calculate standard deviation of these daily returns.

Standard deviation is the square root of variance, which is the average squared deviation from the mean. I have explained its calculation in detail on this page, but you don’t really need to worry about it, because Excel has a built-in function for standard deviation. Actually there are two functions, because there are two kinds of standard deviation: population standard deviation and sample standard deviation. The difference is explained here.

For historical volatility calculation we will use sample standard deviation and the Excel formula for that is STDEV.S (if you are using Excel 2007 or older, the formula is STDEV – without the “.S”; everything else is the same).

This formula takes only one argument and that is the reference to the cells for which we want to calculate standard deviation. It works with as little as two cells or with as much as your computer can handle. We will calculate standard deviation for each day, using a rolling window – a period of n consecutive days ending on the day for which we are calculating the standard deviation.

Which Period Length to Use?

What is n – how many days to include in our rolling window? That is the big decision that you must make when calculating historical volatility. It is often called historical volatility period and it is similarly used with moving averages and other technical analysis indicators.

If you choose a shorter period (small number of days), the resulting historical volatility will more closely reflect the most recent market action, but over time it will fluctuate more (will be more “volatile”). Conversely, if you choose a long period, it will be more stable, but perhaps it might not sufficiently reflect the most recent developments. There is a tradeoff.

If you have no idea, I recommend those I often use myself:

Occasionally I might also look at 10-day historical volatility if something interesting is happening in the market, but I wouldn’t go lower than that.

So let’s use 21 days for our example. We will calculate each standard deviation using the last 21 returns in column C. The first row where we can do this is row 23, where we will use the 21 returns in cells C3 to C23. The standard deviation formula in cell D23 will be:


If you are using Excel 2007 or older, the formula will be:


Calculating standard deviation of returns

We will again copy the formula to all other cells below. Cells D2 to D22 remain empty, because we don’t have sufficient data to calculate these.

Step 4: Annualize Historical Volatility

Actually, we have already calculated a series of historical volatility, because that’s what the standard deviations are. The only problem is that they represent 1-day historical volatility (because there have been calculated from daily returns). Therefore the final step in our calculation is to convert 1-day volatility to annualized volatility, which is much more common and much more useful.

To convert volatility from daily to annual you need to multiply it by the square root of the number of trading days per year.

Why trading days? Because we have been using a series of trading days (weekends and holidays not included).

Why square root? Because volatility (as we are using it now) is standard deviation and standard deviation is the square root of variance, where the number of days (items) actually enters the calculation. For more detailed explanation see why is volatility proportional to the square root of time.

How many trading days are there in a year? This depends on the market you are working with, as different countries and different exchanges observe different holidays. Furthermore, even for the same country and the same exchange the number of trading days varies from year to year. A good long-term average for US markets is 252 trading days per year, which I will use. If you have longer data history and want to be very precise, you can actually count the average number of trading days per year directly from your data. But for now let’s stick with 252.

We will calculate the annualized historical volatility in column E, which will be equal to column D multiplied by the square root of 252. In Excel, the formula for square root is SQRT and our formula in cell E23 will be:


Calculating annualized historical volatility

We will again copy this formula to all the other cells below. We can also format columns C, D, E as percentages.

Historical volatility final result

That’s it. The series you have calculated in column E is historical volatility.

Possible Improvements

There are several ways how we can improve our spreadsheet to make it more useful. In particular:

We can make it support variable historical volatility period length, which the user would enter in some designated cell instead of changing all the standard deviation formulas. Hint: Have a look at the OFFSET Excel function. I will cover this in a second part of this guide.

We can add a chart. This should be very simple and I’ll leave that up to you.

You can find these and some more advanced features in the Historical Volatility Calculator.

Related pages

vix index yahooarithmetic mean roughnessvix options expirationmacd emawhat is a straddle positionvix vs vxxcoloured notepadvar calculation excelvix cashsharpe ratio formula examplemacd chartsn d1 black scholesdefine option contractexcel calculation formulasdifference between arbitrage and hedgingpercent standard deviation calculatorema or smaleveraged short etfcompounded return formulas&p 500 settlement pricemoneyness optioninterpretation of kurtosisgreek calculatordefault font notepadsqrt times sqrtmicrosoft stocks historyoption pricing model excelexcel calculations formulashow to calculate variance on a calculatorreal time vix quotecontinuously compounded return formulawhat does kurtosis meanroot sum square excelwhat is a straddle in optionssquaring definitioncalculate mean variance and standard deviationcost of preferred equityrsi oscillatorhow is vxx calculatedstatistics variance calculatormarket neutral calculatorformula to calculate waccexcel 95 percentilenotional value of futureseuro stoxx 50 optionstheta symbol in excelannualized formulareturns calculator excelexcel formulas standard deviationnotepad backgroundrsi share pricestatistical skewhow to calculate arithmetic average returncboe option calculatorblack scholes model derivationiron butterfly optionsvix futures expiration calendarspx cboemacro hedge fund strategydefine bearishcalculate kurtosisexplain sharpe ratiocalculate covariance excelunderlyingscboe holidayswhat is d1 in black scholesarithmetic mean for grouped data examplevix index bloombergetf short sp500s&p 500 settlement pricevix graphequation for sample variancevix derivativesmacd strategyspx settlementexcel option calculatorstraddle option payoff