79756595

Date: 2025-09-05 09:14:33
Score: 1
Natty:
Report link

Adding my two cents. For anyone looking at this again and who would like to be able to specify the start and end dates per stock, you can make use of the following:

Formula in A6 with a Stock | Start date | End date table/range in cells A2:C4, with Stocks listed in A2, A3, A4, and their corresponding start and end dates in B2:B4 and C2:C4, respectively.

Image of input and output


=LET(
tickers, $A$2:$A$4,
starts, $B$2:$B$4,
ends, $C$2:$C$4,
getStart, LAMBDA(tkr, XLOOKUP(tkr, tickers, starts)),
getEnd, LAMBDA(tkr, XLOOKUP(tkr, tickers, ends)),
stockPrices, LAMBDA(a, STOCKHISTORY(a, getStart(a), getEnd(a), 0, 1, 0, 1, 2, 3, 4)),
output, DROP(UNIQUE(REDUCE("", tickers, LAMBDA(x, tickers, IFNA(VSTACK(x, HSTACK("Exchange\Stock", stockPrices(tickers))), tickers)))), 1),
output
)

Credit to @JvdV and @Gimics.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @JvdV
  • User mentioned (0): @Gimics
  • Low reputation (1):
Posted by: Tom