Stock Return Two Years Formula in Excel

Understanding Stock Return Two Years

The Stock Return Two Years formula in Excel (with MarketXLS) calculates the historical performance of a stock, index, option, or cryptocurrency over a two-year period. It helps investors and analysts quickly gauge long-term returns, compare different assets, and make informed decisions based on a consistent time frame. This function:

  • Retrieves price data from the past two years (731 days).
  • Calculates total return, price return, or other variations such as percentage change.
  • Supports multiple symbol formats, including stocks (e.g., MSFT), indices (e.g., ^SPX), options (e.g., @MSFT 110122C00020000), and cryptocurrencies (e.g., BTCUSD:DEFAULT).

? Pro Tip: Use this formula to measure medium-term trends and validate performance against benchmarks.

Syntax and Parameters

Use the function in your Excel worksheet to quickly fetch and calculate two-year returns.

=StockReturnTwoYears(symbol, [TypeOfReturn])
Parameter Description Required Example
symbol The ticker or symbol to analyze. Acceptable formats: standard stocks, indices, options, or cryptos (e.g., "MSFT", "^SPX", "@MSFT 110122C00020000", "BTCUSD:DEFAULT"). Yes "MSFT"
TypeOfReturn A text value indicating the type of return calculation. Possible values: "RETURN", "TOTAL", "PRICE", "CHANGE", or "CHANGEPERCENT". Defaults to "RETURN" if omitted. No "TOTAL"

Return Value

  • Typically returns a numerical value representing the growth rate over the past two years. For example, 0.20 means a 20% return.
  • Returns "NA" if the symbol is invalid, if no data is found, or if you do not have a valid MarketXLS license.
  • May return "Please enter a valid argument" if an unrecognized TypeOfReturn is provided.

?? Note: Data is updated daily around 5 PM EST. If the data is unavailable or the date range is invalid, you may get an error or "NA".

Examples and Usage

Below are practical ways to use the Stock Return Two Years formula:

  1. Straightforward symbol and default return (returns total or simple return by default):

    =StockReturnTwoYears("MSFT")
  2. Specifying total return type explicitly:

    =StockReturnTwoYears("MSFT", "total")
  3. Retrieving price change instead of total return:

    =StockReturnTwoYears("MSFT", "price")
  4. Using cell references for the symbol:

    =StockReturnTwoYears(A2, "total")

Date Handling (If Needed)

Although this function automatically computes the past two years, below are standard ways to reference dates in other MarketXLS functions.

  • Using cell references:
    =StockFunction(A1)
  • Providing a direct date string:
    =StockFunction("2024-03-15")
  • Using Excel date functions:
    =StockFunction(TEXT(A1,"yyyy-mm-dd"))

? Pro Tip: Combine StockReturnTwoYears with other MarketXLS analytics formulas to analyze dividends, corporate actions, or broader market benchmarks.

Common Questions

1. What if the symbol is invalid or data is unavailable?

You will see an "NA" result. Check that your symbol and license are valid.

2. How is performance calculated?

By default, the formula calculates the return using adjusted closing prices from two years ago to the latest available data. For alternative calculations, use "price", "total", or "change" as the return type.

3. How can I confirm the data accuracy?

MarketXLS sources data from reliable providers and updates it daily around 5 PM EST. For older or infrequent traded assets, always verify the data in an external source.

4. Are there any performance considerations?

  • Retrieving large data sets repeatedly may slow performance.
  • Cache usage in MarketXLS can help speed up repeated queries.
  • If you exceed the maximum historical data limit (in some cases, older than 11 years), you may get restricted or no results.

?? Note: If you need returns for a different period, consider using related formulas like StockReturnThirtyDays, StockReturnSevenDays, or StockReturnFifteenDays.

  • For further assistance, check the MarketXLS knowledge base or contact support.

Get Access to 1 Billion Usable Market data points IN YOUR EXCEL SHEETS WITH EASY TO USE EXCEL FUNCTIONS

Get started today
MarketXLS Excel Add-in Tutorial - How to Use Stock Return Two Years and Other Financial Formulas
How does MarketXLS work?