Average Price Between 2 Dates In History

Returns the average value of a specified price field between two dates. By default, it uses closing prices.

Supported Symbol Formats

Type Format Example
US Stocks SYMBOL AAPL, MSFT
ETFs SYMBOL SPY, QQQ

Parameters

Parameter Description Default
Symbol Stock ticker Required
StartDate Start of range Required
EndDate End of range Required
DataField Price field "close"

DataField Options

  • close - Closing prices (default)
  • high - Daily high prices
  • low - Daily low prices
  • open - Opening prices

Examples

=custom_dates_average("AAPL", DATE(2024,1,1), DATE(2024,3,31))
Q1 average close
=custom_dates_average("AAPL", DATE(2024,1,1), DATE(2024,3,31), "close")
Q1 average close
=custom_dates_average("MSFT", DATE(2024,6,1), DATE(2024,8,31))
Summer average
=custom_dates_average(A1, B1, C1, "close")
From cells

When to Use

  • Calculating average prices in custom periods
  • Quarterly or monthly average analysis
  • Event-based price studies
  • Custom moving averages

When NOT to Use

Scenario Use Instead
Need rolling MA SimpleMovingAverage()
Need high of range custom_dates_high()
Need low of range custom_dates_low()

Common Issues & FAQ

Q: What if dates are reversed (end before start)? A: The function may return incorrect results. Ensure start date is before end date.

Q: Is this a simple or weighted average? A: This is a simple arithmetic average of all trading days in the range.

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 Average Price Between 2 Dates In History and Other Financial Formulas
How does MarketXLS work?