Information functions

STOCKHISTORY

Deferred: needs an outside service

Deferred by policy: the answer needs Microsoft's market data service. DNA Calc does not run this function yet. How we measure this

Local names in 40 languages
LanguageName in Excel
ArabicSTOCKHISTORY
BulgarianSTOCKHISTORY
CzechSTOCKHISTORY
DanishAKTIEHISTORIK
GermanSTOCKHISTORY
GreekSTOCKHISTORY
English (Australia)STOCKHISTORY
English (United Kingdom)STOCKHISTORY
English (United States)STOCKHISTORY
SpanishHISTORIALCOTIZACIONES
EstonianSTOCKHISTORY
FinnishOSAKEHISTORIA
FrenchHISTORIQUE.ACTIONS
HebrewSTOCKHISTORY
CroatianSTOCKHISTORY
HungarianRÉSZVÉNY.ELŐZMÉNYEK
IndonesianSTOCKHISTORY
ItalianSTOCKHISTORY
JapaneseSTOCKHISTORY
KoreanSTOCKHISTORY
LithuanianSTOCKHISTORY
LatvianSTOCKHISTORY
NorwegianAKSJEHISTORIKK
DutchAANDELENGESCHIEDENIS
PolishHISTORIA.AKCJI
Portuguese (Brazil)STOCKHISTORY
Portuguese (Portugal)HISTÓRICODEAÇÕES
RomanianISTORIC STOC
RussianИСТОРИЯАКЦИЙ
SlovakSTOCKHISTORY
SlovenianSTOCKHISTORY
Serbian (Latin)STOCKHISTORY
SwedishAKTIEHISTORIK
ThaiSTOCKHISTORY
TurkishSTOKGEÇMİŞİ
UkrainianSTOCKHISTORY
VietnameseSTOCKHISTORY
Chinese (Simplified)STOCKHISTORY
Chinese (Hong Kong)STOCKHISTORY
Chinese (Traditional)STOCKHISTORY

Names from Microsoft's support site.

What it does

STOCKHISTORY(stock, start_date, [end_date], [interval], [headers], [property0], [property1], [property2], [property3], [property4], [property5])

STOCKHISTORY fetches historical prices for one instrument and spills them as a table of ordinary numbers and dates. The values come from Microsoft's data provider, not from the workbook.

STOCKHISTORY(stock, start_date, [end_date], [interval], [headers], [property0], ..., [property5])

  • stock is a ticker in double quotes, or a cell holding a Stocks data type. To name an exchange, put its four-character market identifier code and a colon first, as in "XNAS:MSFT".
  • start_date is the first date requested.
  • end_date defaults to start_date, so leaving it out asks for one period, not for data up to today.
  • interval is 0 daily (default), 1 weekly or 2 monthly.
  • headers is 0 none, 1 headers (default), or 2 instrument identifier and headers.
  • property0 to property5 choose the columns, in the order you list them:
CodeColumn
0Date
1Close
2Open
3High
4Low
5Volume

The default columns are Date and Close.

Try it

DNA Calc does not run this function yet: its answer needs an outside service. In Excel you would write:

=STOCKHISTORY("MSFT",DATE(2026,1,1),DATE(2026,1,8))

Quirks

  • The first row can precede start_date. Non-daily intervals report the first day of the period that holds the date. Daily and weekly rows use the first valid trading day; monthly rows use the first calendar day.
  • Each column is a period summary. Close is the last trading day's close, Open the first day's open, High and Low the period's extremes, Volume the total.
  • Today is missing until the market closes. Data generally updates after the trading day ends.
  • Some instruments have no history. Microsoft notes that many index funds and some other items offered as Stocks data types have none.
  • Column order is yours. Date appears only if requested, or by default.
  • Headers add a row. The default output is one row taller than the data, which matters to any formula indexing into the result.
  • No formatting is applied, so cells go back to General if the formula is removed.

When the service is unavailable

Microsoft's function page does not say what happens when the service cannot be reached. Its general article says #CONNECT! means a formula could not reach a resource it needs. A Microsoft Q&A answer, which is not official documentation, reports that error for this function. With volatile functions such as TODAY and automatic calculation, data refreshes in the background when the workbook opens, and editing continues meanwhile. A subscription is also needed: Microsoft lists Microsoft 365 Personal, Family, Business Standard and Business Premium. No failure of this function has been recorded here.

How to implement

DNA Calc does not run this function yet. It is deferred by policy, because the data comes from a back end Microsoft hosts and controls. An implementation needs:

  1. A licensed data feed with the same instruments, exchanges and adjustment rules.
  2. Period logic: trading calendars per exchange, for the first valid day of each period.
  3. Column assembly: an array built from property order, with headers rows.
  4. Asynchronous calculation with a result that can spill late, and a failure outcome such as #CONNECT!.
  5. Argument rules for tickers, data types, exchange prefixes and date coercion.

Answers would depend on the provider chosen, so another feed could not promise Excel's values.

Rust code

This entry has no Rust implementation yet.

No implementation has been published with a Handbook test suite for this function.

Version differences

No Excel answers for this function are recorded here, so no comparison between Excel builds exists. Microsoft's page lists Excel for Microsoft 365 on Windows and Mac. Past prices can also change at the provider, so an old answer is not a stable reference.

Alternatives

  • The Stocks data type with FIELDVALUE for current fields.
  • Power Query against a data source you license, for a stored and repeatable history.
  • Recording a result as values, when a report has to stay fixed.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents