Financial

STOCKHISTORY Function in Excel

Retrieves historical stock price data from Microsoft's data provider.

Syntax

  • =STOCKHISTORY(stock, start_date, [end_date], [interval], [headers], [properties])

Arguments

  • stock (required): Stock ticker symbol or linked stock data type
  • start_date (required): Start date for historical data
  • end_date (optional): End date (defaults to today)
  • interval (optional): 0=daily, 1=weekly, 2=monthly
  • headers (optional): 0=no headers, 1=include headers
  • properties (optional): 0=date/close, 1=date/open/high/low/close/volume

Examples

  • =STOCKHISTORY("MSFT", DATE(2024,1,1)) - Microsoft stock since Jan 2024 - Result: Historical prices
  • =STOCKHISTORY("AAPL", DATE(2024,1,1), TODAY(), 1, 1, 1) - Apple weekly with all data - Result: Full stock data

STOCKHISTORY modeling tips

  • Align rate and period units (annual rate ÷ 12 for monthly models).
  • Use consistent cash-flow signs (outflows negative, inflows positive).
  • Hub: [Financial functions guide](/guides/excel-financial-functions-guide/).

Common errors

  • #VALUE! if ticker not found
  • #CONNECT! if data unavailable

Use cases

  • Stock analysis
  • Portfolio tracking
  • Financial modeling
  • Investment research

Frequently asked questions

  • What is the STOCKHISTORY function in Excel? STOCKHISTORY retrieves historical stock price data from Microsoft's data provider. The syntax is =STOCKHISTORY(stock, start_date, [end_date], [interval], [headers], [properties]). Typical use cases include stock analysis, portfolio tracking, financial modeling.
  • How do I use the STOCKHISTORY function? To use STOCKHISTORY, type =STOCKHISTORY( in a cell and provide the required arguments. Excel will show you the syntax and parameter hints as you type. Make sure to close the parentheses and press Enter to execute the function.
  • Why is STOCKHISTORY not working in my Excel? Common issues with STOCKHISTORY include #VALUE! if ticker not found; #CONNECT! if data unavailable. Start by checking the syntax =STOCKHISTORY(stock, start_date, [end_date], [interval], [headers], [properties]), then verify each referenced cell or range.

Editorial review

  • Reviewed by Excel.Directory Editorial Team. Updated May 2026.