Stock Return Between Two Dates In Past Formula in Excel
Leverage the power of the Stock Return Between Two Dates In Past formula in Excel with MarketXLS to track how a stock’s value changes over a custom date range. This function offers quick insights into price returns or total returns, helping you make informed investment decisions.
Understanding Stock Return Between Two Dates In Past
- Purpose: The
StockReturnCustomDates
function (display name: Stock Return Between Two Dates In Past) calculates the return of a specified ticker symbol between two custom dates. - Key Benefits:
- Quickly measures performance over any custom time frame.
- Supports multiple return types (price return or total return).
- Compatible with various ticker formats (stocks, indices, options, and crypto).
- When to Use: Apply this function whenever you need to assess how a stock’s value has changed between two past dates, be it for performance review, analysis, or reporting.
Syntax and Parameters
=StockReturnCustomDates(Symbol, StartDate, EndDate, [TypeOfReturn])
Parameter | Description | Required | Example |
---|---|---|---|
Symbol |
Ticker symbol of the asset. Supports stocks (e.g., "MSFT"), indices (e.g., "^SPX"), options (e.g., "@MSFT 110122C00020000"), and crypto (e.g., "BTCUSD:DEFAULT"). | Yes | "MSFT" |
StartDate |
Start date (in “YYYY-MM-DD” format). Can be a cell reference, a direct string, or an Excel date function’s result. | Yes | "2023-01-01" |
EndDate |
End date (in “YYYY-MM-DD” format). Similar input methods as StartDate . |
Yes | "2023-06-30" |
TypeOfReturn |
Optional return type: "return", "price", "total", "change", "changepercent". Blank defaults to "return". | No | "total" |
?? Note: If the symbol is invalid or the date range is out of scope, the function may return
"NA"
.
Return Value
- By default, returns the percentage change from the initial closing price to the final closing price (e.g., 0.05 for a 5% gain).
- If
TypeOfReturn
is specified as"change"
or"price"
, it returns a numeric difference. - If an error occurs, the function returns
"NA"
.
Examples and Usage
Below are practical examples demonstrating how to use the Stock Return Between Two Dates In Past formula.
Basic Examples
-
Direct date inputs:
=StockReturnCustomDates("MSFT", "2023-01-01", "2023-06-30")
This calculates the default return (percentage change) for Microsoft from January 1, 2023 to June 30, 2023.
-
Specifying return type as total return:
=StockReturnCustomDates("MSFT", "2023-01-01", "2023-06-30", "total")
This includes dividends in the calculation, if available.
-
Using Excel date functions:
=StockReturnCustomDates("MSFT", TEXT(A1,"yyyy-mm-dd"), TEXT(B1,"yyyy-mm-dd"), "price")
Converts the date in cells A1 and B1 to the required string format and calculates the price return.
? Pro Tip: You can also reference cells containing symbols and dates, or directly input them as strings.
Symbol Variations
• Regular stocks:
=StockReturnCustomDates("AAPL", "2023-01-01", "2023-06-30")
• Indices:
=StockReturnCustomDates("^SPX", "2023-01-01", "2023-06-30")
• Options:
=StockReturnCustomDates("@MSFT 110122C00020000", "2023-01-01", "2023-06-30", "change")
• Crypto:
=StockReturnCustomDates("BTCUSD:DEFAULT", "2023-01-01", "2023-06-30", "changepercent")
Performance Considerations
- The function relies on MarketXLS data servers, particularly when retrieving large date ranges.
- Returns may be limited to data within the past 6–11 years, depending on symbol type and data availability.
- Complex queries or large date ranges may take slightly longer to compute.
Common Questions
-
What happens if I enter a date older than 11 years?
If the start date is too old, the function may return an error message such as"Start date too old..."
or"NA"
. -
How do I handle invalid tickers or missing data?
The formula returns"NA"
if it cannot fetch valid data for the specified symbol. -
How to interpret the results for “changepercent” or “price”?
"changepercent"
: Returns numeric percentage change (e.g., 0.05 for 5% increase)."price"
or"change"
: Returns the numeric difference in closing prices (e.g., 10.5 for a $10.50 increase).
-
Can I use this formula to calculate dividends paid between two dates?
This specific function is focused on returns. For dividends, consider using the related MarketXLS function “Total Dividends Paid Between Two Days In The Past.”
?? Note: Always verify that your MarketXLS license is valid to avoid errors or the
"NA"
response.
By using the Stock Return Between Two Dates In Past formula, you can quickly evaluate how an investment has performed over any specified period—vital for comparing historical returns, running what-if scenarios, and enhancing your data-driven decision making.