Contact

STOCKHISTORY in Excel: Choose Historical Data Columns and Periods

Lookup and Reference Intermediate Microsoft Excel

Plan a historical-data spill with explicit exchange, date, interval, header and property controls, without confusing period labels with trading dates.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

STOCKHISTORY retrieves historical financial-instrument data as a dynamic array. The formula defines which instrument, period and columns a report requests. It is important to separate that request from an actual provider response: a syntactically complete formula does not establish availability, row count, prices or the meaning of an instrument’s history.

Availability before syntax

Microsoft’s dedicated reference lists Excel for Microsoft 365 on Windows and Mac and explicitly requires Microsoft 365 Personal, Family, Business Standard or Business Premium. This page does not establish support for perpetual Excel editions or the web client. It also warns that a Stocks data-type instrument may lack historical data. Official requirements

No subscription was purchased or activated here. No market data was queried. Check the actual entitlement and instrument coverage in the intended environment before depending on a report. The examples below specify requests and conditional array structure, not observed prices or investment recommendations.

Syntax and option map

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

Use a ticker, an exchange-qualified MIC:ticker string, or a Stocks data-type cell for stock. The required start_date begins the request. If end_date is omitted, it defaults to start_date. Interval defaults to 0; headers defaults to 1. With no property arguments, the columns are Date and Close. Explicit properties replace that default selection and appear in the order supplied. Microsoft’s argument definitions

Option Codes
interval 0 daily; 1 weekly; 2 monthly
headers 0 none; 1 headings; 2 instrument identification plus headings
properties 0 Date; 1 Close; 2 Open; 3 High; 4 Low; 5 Volume

Numbers such as 0 and 2 therefore have different meanings in different argument positions. Label the controls if they live in worksheet cells; otherwise a later edit can accidentally change the interval instead of the selected property.

Worked request: Date, Open and Close

The Microsoft reference uses the exchange-qualified symbol XNAS:MSFT. The following original example uses that documented symbol with a different, explicitly bounded date range:

=STOCKHISTORY("XNAS:MSFT",DATE(2024,4,16),DATE(2024,4,30),0,1,0,2,1)

Read it from left to right:

  1. Request the identified instrument on its specified exchange.
  2. Request the date range April 16–30, 2024.
  3. Use daily observations.
  4. Include the header row.
  5. Request three columns, in order: Date, Open, Close.

If the service succeeds and supplies observations, the result would occupy three columns. The number of data rows depends on available trading observations; no particular count is asserted here. No sample prices are invented. A schematic layout is a heading row for those three fields followed by provider-supplied dates and values, all currently unobserved.

Use DATE or cells containing genuine dates to avoid ambiguity from locale-dependent date strings. Keep the requested start/end dates visible beside the result. A chart or calculation derived from a spill is easier to audit when readers can see the request that generated it.

Period labels are not all trading dates

For daily or weekly intervals, Date represents the period’s first valid trading day. For monthly intervals, it is the first calendar day of the month. Open/Close refer to first/last trading-day prices; High/Low summarize extrema, and Volume covers trading during the period. Microsoft’s property definitions

Consider this unexecuted monthly request:

=STOCKHISTORY("XNAS:MSFT",DATE(2024,4,16),DATE(2024,6,14),2,1,0,1)

A returned April monthly observation would carry April 1 as its period label, even though the request starts April 16. That label does not mean a trade occurred on April 1, nor does it independently establish what observations the provider included in the returned period aggregate. Review interval semantics before interpreting a date label as a transaction timestamp. The reference explicitly warns that a non-daily first point may precede the requested start date.

Advanced use: a single metric for a downstream calculation

A report interested only in period highs could request property 3 without Date and without headers:

=STOCKHISTORY("XNAS:MSFT",DATE(2024,1,1),DATE(2024,3,31),2,0,3)

This specifies a one-column data-only result if retrieval succeeds. A surrounding MAX would ask for the largest returned high. No numerical maximum is asserted. Keep a separately inspectable date-bearing request during validation so the calculation’s coverage can be reviewed. Omitting dates reduces visible context; it does not make data quality or period selection less important.

For current-session monitoring, this function is a poor assumption: Microsoft says history generally updates after the trading day completes. Requests involving TODAY can refresh on opening when automatic calculation is enabled, so such a workbook is not necessarily a fixed historical snapshot. Microsoft’s update notes

Spill and failure handling

Reserve empty worksheet space for the returned array. Microsoft documents #SPILL! when an array’s destination is obstructed, and spilled array formulas are not supported inside Excel tables. Only the leading formula cell controls the spill. Microsoft’s dynamic-array guide

Separate layout problems from entitlement, symbol, date-range and coverage problems. The STOCKHISTORY page does not supply a complete error-code mapping for every service failure, so this guide does not invent one. Do not replace an unavailable history with zero prices. Preserve the error and request parameters, then verify that the instrument and period are supported. Returned headers are part of the array, so choose headers=0 deliberately when a downstream operation expects only data.

Verification limits

First introduction and last functioning build are unknown; the current product list is not release history. The reference was checked October 18, 2026. No application execution, live historical quote, refresh or screenshot was produced. All array descriptions are conditional contracts, not fabricated market observations.

Official STOCKHISTORY reference.