wilsonx63

Copper Contributor
stock function: I need to redeem stock closing quotes from previous months. how do I do.

my excel is 365 insider beta
2 Replies

@wilsonx63 

 

The Stocks Data Type won't get historical prices. But you can use the technique described here:

Excel University: Get Current and Historical Stock Prices 

 

The drawback is you need to pass one stock code at a time.

 

I used that technique and a date filter to get AMZN prices from June of this year.

 

This is the query:

 

let
    Source = Web.Page(Web.Contents("https://finance.yahoo.com/quote/AMZN/history/")),
    Data2 = Source{2}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Data2,{{"Date", type date}, {"Open", type number}, {"High", type number}, {"Low", type number}, {"Close*", type number}, {"Adj Close**", type number}, {"Volume", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each Date.IsInPreviousNMonths([Date], 1))
in
    #"Filtered Rows"

 

 

@wilsonx63 

For Insiders Beta STOCKHISTORY() shall be available

image.png

formula is

=SORT(STOCKHISTORY("AMZN",DATE(2020,6,1),DATE(2020,6,30),0,2,0,2,3,4,1,5),,-1)