Financial function

STOCKHISTORY function

Retrieves historical price data (close, open, high, low, volume) for a stock, fund, index or currency pair from the internet as a spilled table.

Available in Microsoft 365 only (Windows, Mac and Excel for the web) with an internet connection; requires a Microsoft 365 subscription

Microsoft 365 onlyNot in Google Sheets

Syntax

STOCKHISTORY(stock, start_date, [end_date], [interval], [headers], [property0], [property1], ...)
ArgumentWhat it means
stockRequiredTicker symbol in quotes such as "MSFT", an exchange-qualified code like "XNAS:MSFT", or a cell with the Stocks data type.
start_dateRequiredFirst date to retrieve.
end_dateOptionalLast date. Default: same as start_date.
intervalOptional0 = daily (default), 1 = weekly, 2 = monthly.
headersOptional0 = no headers, 1 = show a header row (default), 2 = show the instrument name and headers.
property0, ...OptionalWhich columns to return and in what order: 0 Date, 1 Close, 2 Open, 3 High, 4 Low, 5 Volume. Default: Date and Close.

Returns: A dynamic array (spilled table) of dates and prices.

How STOCKHISTORY works

STOCKHISTORY downloads historical market data straight into your sheet. Give it a ticker and a date range and it spills a table of dates and closing prices; add arguments to switch to weekly or monthly data and to request open, high, low and volume columns. It is ideal for charting a share's performance, comparing two funds, or tracking an exchange rate such as "USD/EUR" over time.

The data comes from an online provider (Refinitiv/LSEG), so it needs a connection and can update when the workbook recalculates. Only trading days appear in daily data, so weekends and market holidays are skipped. Prices are in the instrument's own currency and may be delayed; Microsoft notes the data is for information, not trading. Because the result spills, keep the cells below and to the right empty.

The numbers shown in the examples below depend on the market, so the results describe what Excel returns rather than exact prices.

Examples

1Daily closing prices for one week

A4fx=STOCKHISTORY(A2,B2,C2)
ABC
1TickerFromTo
2MSFT2026-11-022026-11-06
3
4A 2-column table: a header row (Date, Close) and one row per trading day from 2 to 6 Nov 2026 — 6 rows in total, with prices from the live data feed

Result: A 2-column table: a header row (Date, Close) and one row per trading day from 2 to 6 Nov 2026 — 6 rows in total, with prices from the live data feed

With only the required arguments you get daily data, a header row and the default Date and Close columns. Format the Date column as dates if Excel does not do so automatically.

2Monthly open, high, low and close

A4fx=STOCKHISTORY(A2,B2,C2,2,1,0,2,3,4,1)
ABC
1TickerFromTo
2XNAS:MSFT2026-01-012026-06-30
3
4A 5-column table (Date, Open, High, Low, Close) with a header row and one row per month, January to June 2026

Result: A 5-column table (Date, Open, High, Low, Close) with a header row and one row per month, January to June 2026

interval 2 returns monthly bars; headers 1 keeps the header row; properties 0, 2, 3, 4, 1 choose the columns and their order.

3Latest close only, no headers

B2fx=TAKE(STOCKHISTORY(A2,TODAY()-7,TODAY(),0,0,1),-1)
AB
1TickerLast close
2MSFTA single number: the closing price of the most recent trading day in the last seven days

Result: A single number: the closing price of the most recent trading day in the last seven days

headers 0 and property 1 return just a column of closing prices, listed oldest first. TAKE with −1 keeps only the last row, the latest close. INDEX(...,1) would instead return the oldest price of the week.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 15 KB

Common errors and how to fix them

ErrorWhy it happensFix
#BLOCKED! / #CONNECT!No internet connection, or the service is unavailable or blocked by your organisation.Check the connection and try again later.
#VALUE!Unknown ticker, invalid dates, or an invalid property code.Check the symbol (add the exchange code, e.g. XLON:VOD) and the arguments.
#SPILL!Cells in the spill range are not empty.Clear the area below and to the right of the formula.

Tips

  • Use exchange-qualified codes such as "XNYS:KO" or "XLON:BP." to avoid ambiguous tickers.
  • Currency pairs work too: =STOCKHISTORY("EUR/USD",start,end).
  • The workbook needs Microsoft 365 to refresh; in older versions the spilled values stay but cannot update.

Google Sheets

Use GOOGLEFINANCE(ticker, "close", start_date, end_date, "DAILY") for historical prices.

STOCKHISTORY in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
DanishAKTIEHISTORIK
DutchAANDELENGESCHIEDENIS
FinnishOSAKEHISTORIA
HungarianRÉSZVÉNY.ELŐZMÉNYEK
Norwegian (Bokmål)AKSJEHISTORIKK
PolishHISTORIA.AKCJI
Portuguese (Portugal)HISTÓRICODEAÇÕES
RussianИСТОРИЯАКЦИЙ
TurkishSTOKGEÇMİŞİ