over the past n days, wherenis a variable that can be changed as desired.

In addition, the data should be sorted in reverse chronological order, with the latest information appearing first.

Simple example

STOCKHISTORY retrieves historical stock price information based on a given symbol and date range.

Apple’s close price on December 27, 2022

For a more detailed discussion, see ourSTOCKHISTORY function page.

STOCKHISTORY configuration

In the more complex example shown above, we need to supply additional information.

This results in a date 30 days earlier than the date returned by TODAY.

Apple’s close price on December 27, 2022

This works becauseExcel dates are just large serial numbers.

Theend_dateis simply the value returned by TODAY the current date.

The STOCKHISTORY function supportssix properties that are specified by number.

Apple’s close price on December 27, 2022

When entered, the result will be anarraythat willspillinto multiple cells.

By default, STOCKHISTORY will return information in chronological order with older dates appearing first.

The output also depends on the time of day.

Apple’s close price on December 27, 2022

If the market is already closed, STOCKHISTORY will return information for the current date.

Sorting results

In the example shown, we want to sort results in reverse chronological order.

The output of this formula is fully dynamic.

Apple’s close price on December 27, 2022

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

Values can be sorted by one or more columns.

SORT returns a dynamic array of results.

Excel formula: Get stock price (latest close)

Excel formula: Get stock price on specific date

Excel formula: Get stock price last n months

Excel formula: Get current stock price

Excel STOCKHISTORY function

Excel SORT function