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.
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.
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.
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.
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.
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.