US Treasury Rate Analysis Using Excel

The US Government, via the US Treasury, offers a wide range of fixed income securities to investors for the purposes of Government funding. These securities are categorised as US Treasury bills, notes or bonds – all are equivalent, the different terminology simply refers to the different maturities. The are often referred to simply as “US Treasuries”:

  • Treasury Bonds: Mature in either 20 or 30 years
  • Treasury Notes: Mature between 2 and 10 years
  • Treasury Bills: Mature from 4 weeks upto one year

The US Treasury Rate (or Yield) is the effective interest rate that the US Government pays on it’s debt. This is the rate that holders of a US Treasury can expect to receive, and as you might expect this rate varies depending on a number of factors.

Some of the many factors, both US and global, that can influence rates are:

  • How much confidence investors have in the US economy as well as the global economy
  • Current and expected inflation rates
  • Current and expected market uncertainty and volatility

The most influential and closely monitored US Treasury is the 10 Year Treasury Note. It is used as a benchmark rate for setting lending rates, in particular for banks to calculate mortgage rates. It is also used as a gauge of investor confidence.

When investor confidence drops, US Treasury rates tend to drop as investors move out of risky assets and into the safe haven of US Government backed securities – and conversely when investors are confident, which usually means stock markets are buoyant then rates will increase to attract reluctant investors back into Treasuries.

Using Excel we can look at current and historical US Treasury rates. The US Treasury makes this data freely available and you can use the Excel Price Feed Add-in formulas to easily get this data into your Excel spreadsheet.

Using the Excel formula below we can retrieve a historical time series (1000 daily data points) of US Treasury yields:

=EPF.Nasdaq.HistoricLookback("USTREASURY","YIELD", 1000)

And then plot this data (for the 10 Year Treasury Note) using an Excel chart:

US 10 Year Treasury historical data plotted on an Excel chart.

We can see that during 2020, when the world was in the grip of the COVID-19 pandemic, yield/rates dropped dramatically down to around 0.5% as investors moved out of risky assets and US Treasuries became highly sought after. Yields then steadily rose but have dropped back recently as inflation spiked and interest rates rose around the globe to combat it.

In addition to analysing historical trends of a single US Treasury we can analyse the difference between Treasuries of different maturities, otherwise known as the spread.

Below we can see the 10 Year – 2 Year Spread, perhaps the most common spread used for analysis, and we can see that it is currently “inverted”, i.e. below zero – the 10 Year yield is less than the 2 Year yield. This is often recognised as a leading indicator of a forthcoming recession:

US 10 year minus 2year treasury yield spread

We can use another of the Excel Price Feed formulas, such as the one below:

=EPF.Nasdaq.Last("USTREASURY","YIELD","10 yr")

to retrieve a single data point, the current yield for a single maturity (in this case the 10 Year). Applying a simple data bar visualization in Excel enables us to see how current yields across maturities compare:

US Treasury Yield Rates in an Excel spreadsheet

We can now clearly see that the 10 year currently has the lowest yield, whereas the 6 month rate has the highest – a spread of over 1%.

I hope this article has given a good overview of what US Treasuries are and how you can use Excel and the Excel Price Feed Add-in formulas to bring US Treasury data into your Excel spreadsheet.

[Click here to download the spreadsheet used in this article]

Technical Analysis Using Excel

Simple Moving Average (SMA) chart in Excel

Technical Analysis is used by traders and investors to help identify patterns and trends in historical financial prices. This analysis is often used to produce trading signals or to backtest a trading strategy.

Excel should be a great tool for technical analysis, however traders and investors often struggle with three problems:

  • Getting historical price and volume data into Excel.
  • Writing formulas for indicator calculations.
  • Updating their spreadsheet when new price data is available.

These problems are all solved by using the Excel Technical Analysis Toolkit which has just been released as a new feature of the Excel Price Feed Add-in.

The Toolkit provides a library of new easy-to-use Excel Technical Analysis formulas, so there is no longer a need for complicated Excel formulas or obscure and hard-to-maintain VBA.

Getting historical price and volume data into Excel

Usually, this is achieved by either copying/pasting data from a website/datafeed or downloading a file of prices. With Excel Price Feed you can use one of the many historical data formulas to easily pull prices into your spreadsheet.

For example, to pull daily historical close prices into Excel for the S&P500 Index, you can use this formula:


Where 200 is the number of days we need, DESC means display the data in DESCending order, so more recent day first, and 1 means show column headings:

S&P500 historical close prices in Excel

Now that we have the historical price data in Excel, we can now perform some Technical Analysis.

Excel Formulas for Technical Analysis

Suppose we want to look at how Bollinger Bands perform for the S&P500 year-to-date using a 20-period lookback with 2 standard deviations.

Without Excel Price Feed, this is how to calculate Bollinger Bands using standard Excel formulas (note that this shows only one third of the steps required):

As you can see there are a lot of steps and formulas. The equivalent Bollinger Band formula using Excel Price Feed is:

EPF.TA.BollingerBands(prices, dates, lookbackPeriod, standardDeviations)

The first two parameters are simply the close price and date columns of the historical data, and the other two parameters are the number of periods in the lookback and the number of standard deviations.

This is what it looks like in Excel:

Bollinger Bands Excel formula output

Now that the data is in Excel we can easily add an Excel chart to visualize how the bands move with price, and from this we can start to identify support and resistance and potential trend changes:

SPY Bollinger Bands visualized using an Excel chart

Updating the spreadsheet when new price data is available

To produce this data we have used two formulas, one for the historical data and one for the technical analysis. When we want to update the data in our spreadsheet, we simply refresh the spreadsheet. This will result in the latest daily close prices being downloaded and the Bollinger Bands being recalculated.

No more copying and pasting data or formulas.

Excel Price Feed has a built in Refresh button as well as automatic refresh functions:

Excel Price Feed Refresh options.

To find out more about Excel Price Feed head over to the website and try it free for 10 days:

American Depository Receipts (ADRs)

What is an ADR?

An ADR is a stock certificate, denominated in US dollars, issued by a US based bank or broker. It represents a specific number of shares, usually one, in a foreign company’s stock i.e. a company that is not listed on a US stock exchange.

ADRs are listed and are tradeable on a US stock exchange such as the NYSE and trade in an equivalent way to any US based stock.

Why trade an ADR?

An ADR enables US investors to gain exposure to foreign stocks without the complication of trading on foreign exchanges. Also, because ADRs are priced in US dollars and their dividends are paid in US dollars, investors do not need to deal with foreign exchange conversions.

In addition, foreign companies find them beneficial as they can attract US based investors without needing to list on a US based stock exchange.

How to retrieve ADR prices in Excel

The Excel Price Feed Add-in provides access to ADR prices via the Yahoo Finance connector.

We can find the ADR ticker/symbol using the built-in search function.

For example, below we are searching for the SAP ADR. SAP is a German software company listed on the German stock exchange but not listed in the US:

Searching for the SAP ADR in Excel Price Feed

Here we can see both the German listed stock (SAP.DE on the GER Exchange) as well as the ADR (SAP) listed on the NYSE (NYQ Exchange).

ADRs are treated like regular US stocks, so for example to request the current price of the SAP ADR we use the following Excel formula:


Which gives the following result in Excel:

SAP ADR stock price in Excel

I hope this gives a good overviews of ADRs and how to easily retrieve ADR data in Excel.

Market Performance 2022 YTD using Excel

Just a quick blog post today, looking at market performance for a bunch of stocks so far this year (otherwise known as year to date or YTD).

As a reference point, today (24 March 2022) the S&P500 is at -6.2% and the Nasdaq is at -11% for YTD.

I am using the Excel Price Feed Add-in to download latest price data and start of year prices for a small set of diverse US stocks. I use the live price formula (EPF.Yahoo.Price) in column C together with the historical price formula (EPF.Yahoo.Historic.Close) in column D to retrieve the stock price on the first trading day of the year which was 3rd January.

This produces the following data table (you can see the formula for cell D2 in the formula bar):

2022 YTD Stock Performance in Excel using the Excel Price Feed Add-in

Now that we have the current stock price and at the start of the year we can calculate the % change using a simple Excel formula which works out the difference (C2-D2) as a proportion of D2:

Calculate stock price YTD change in Excel

Now we can apply this formula to the rest of the table and create a simple bar chart to visualize the performance:

YTD stock performance bar chart in Excel

As we can see the tech sector is under-performing, particularly Facebook and Netflix whilst the oil giants Exxon and Chevron are out-performing everything else.

I hope this gives a good introduction to stock analysis using Excel, to find out more about Excel Price Feed head over to the website and try it free for 10 days:

Excel: Calculate trading days between two dates

Yesterday a customer contacted us asking if our financial markets data Add-in could calculate the number of trading days between two dates. Unfortunately we don’t have this functionality as implementing it is not as easy as you may think.

You need to take into account weekends, which for most financial markets are Saturday and Sunday. Exceptions to this include several markets in the Middle East such as Saudi Arabia where the working week is Sunday to Thursday and the “weekend” is Friday and Saturday.

You also need to account for market holidays which are usually, although not always, also national holidays.

Fortunately Excel provides the NETWORKDAYS function, which:

Returns the number of whole working days between start_date and end_date. Working days exclude weekends and any dates identified in holidays.

This function can be used, together with a holiday lookup, to provide the functionality we need.

NETWORKDAYS function in Excel

In the example above we are using a holiday list lookup in column D together with the NETWORKDAYS function in cell B4 to compute the trading days between 21 July 2020 and 1 Dec 2020 for the US market.

The NETWORKDAYS function assumes that weekends are Saturday and Sunday. If you wish to specify a different weekend then you can use the NETWORKDAYS.INTL function.