Excel Function

Excel STOCKHISTORY function

Pull real historical stock prices directly into Excel — no API, no add-in, no manual downloading.

STOCKHISTORY retrieves historical price data for a stock, fund, or currency pair from Microsoft's data provider and spills it directly into your spreadsheet. One formula can return months of daily closing prices, ready for analysis or charting.

Syntax

STOCKHISTORY(stock, start_date, [end_date], [interval], [headers], [property0, ...])
ArgumentWhat it means
stock requiredTicker symbol as text, e.g. "AAPL", "MSFT", "BTC/USD".
start_date requiredThe first date to retrieve data for.
end_date optionalThe last date. Defaults to today if omitted.
interval optional0 = daily (default), 1 = weekly, 2 = monthly.
headers optional0 = no headers, 1 = header row, 2 = instrument + header rows.
property0 optional0=Date, 1=Close, 2=Open, 3=High, 4=Low, 5=Volume. Default returns Date and Close.

Examples

Last 90 days of Apple closing prices

=STOCKHISTORY("AAPL", TODAY()-90, TODAY(), 0, 1)

Monthly prices for the full year, with OHLC data

=STOCKHISTORY("MSFT", DATE(2026,1,1), DATE(2026,12,31), 2, 1, 0, 2, 3, 4, 1)

Returns columns: Date, Open, High, Low, Close — with a header row.

Bitcoin/USD price history

=STOCKHISTORY("BTC/USD", DATE(2026,1,1))
⚠️ Requires Microsoft 365 and an internet connection

STOCKHISTORY pulls live data from Microsoft's servers. It requires an active Microsoft 365 subscription, an internet connection, and the Stocks data type enabled. It is not available in Excel 2021, 2019, or offline installations.

💡 Combine with AVERAGE for a moving average

Once STOCKHISTORY spills price data into a column, you can reference those cells in AVERAGE, STDEV, or MAX/MIN formulas just like any other data — building a full price analysis without downloading a single CSV.

How current is the data?
STOCKHISTORY returns historical data, not real-time prices. There is typically a 15–20 minute delay for market data, and end-of-day data is usually available the following morning.
What markets and tickers are supported?
Major global exchanges including NYSE, NASDAQ, LSE, and others. Use the same ticker symbols shown on financial sites. Not all smaller exchanges or OTC stocks are available.

Practice STOCKHISTORY for real

Type it in a live spreadsheet, get instant feedback. No videos, no downloads.

Start practising free →