The main purpose of STOCKHISTORY is to get the history of a financial instrument over time.

Note that STOCKHISTORY retrieves multiple results.

The result is anarrayof values thatspillonto the worksheet into multiple cells.

STOCKHISTORY function - daily results example

Each argument is described in detail below.

Additional properties are described in thetable here.

Properties are specified with the numeric code seen in the “Code” column.

STOCKHISTORY function - daily results example

The order in which you request properties is the order in which they will appear.

See:STOCKHISTORY properties example.

To refer to Microsoft Corporation on Austria’s Wiener Boerse exchange, use “XWBO:MSFT”.

STOCKHISTORY function - daily results example

The table below lists the 4-character code for a few common exchanges.

you might find a full list of supported exchange codeshere.

With this configuration, the STOCKHISTORY function returns 19 results.

STOCKHISTORY function - daily results example

Also note theDATE functionis used to supply the start and end dates.

For a more detailed explanation,see this example.

The result is the close price for Tesla (“TSLA”) for the 12 months in 2021.

STOCKHISTORY function - daily results example

If the values in F6:F8 are changed, the results from STOCKHISTORY will automatically update.

Notice these are thelast 5 argumentsin the function.

Note that the reason STOCKHISTORY uses numeric codes for properties is so they can be easily reordered.

STOCKHISTORY function - monthly close prices

Example - A horizontal layout for multiple stocks

By default, STOCKHISTORY returns information in averticallayout.

To display results in ahorizontallayout, it’s possible for you to use theTRANSPOSE function.

The end date is created in the same way and is the first day of the previous month.

STOCKHISTORY function - variable inputs example

The formula here is a variation of anexample explained in greater detail here.

In the worksheet below, the exchange is variable and entered in cell F5.

STOCKHISTORY function - custom properties example

STOCKHISTORY function - same properties, different order

STOCKHISTORY function - horizontal layout example

STOCKHISTORY function - last 6 complete months

STOCKHISTORY function - variable exchange example

STOCKHISTORY function - currency exchange rate example

Excel formula: Get current stock price

Excel formula: Get stock price last n months

Excel formula: Get stock price (latest close)

Excel formula: Currency exchange rate example

Excel formula: Get stock price last n days

Excel formula: Get stock price on specific date

STOCKHISTORY function - daily results example

STOCKHISTORY function - monthly close prices

STOCKHISTORY function - variable inputs example

STOCKHISTORY function - custom properties example

STOCKHISTORY function - same properties, different order

STOCKHISTORY function - horizontal layout example

STOCKHISTORY function - last 6 complete months

STOCKHISTORY function - variable exchange example

STOCKHISTORY function - currency exchange rate example