I have a spreadsheet with the first column as a Date field and the rest of the columns are ticker symbols for different stocks, like so:
Date:
AAPL:
PINS:
ROKU:
The problem is that the STOCKHISTORY() function is not returning a consistent number of rows for each stock. AAPL returns all expected rows, but ROKU only returns 991 rows (it IPO'ed in 9/28/2017). The PINS formula only returns 601 rows, since it IPO'ed in 4/18/2019. So for example the very first row that I'm seeing looks like this:
The PINS and ROKU values are completely incorrect, since they reflect the stock price on their IPO dates instead of 12/31/2015. Is there any way to ensure that all formulas will return the same number of rows so I don't have to also return the DATE field for every single stock? For all dates that don't have data, I'd be fine with just an NA() error for all dates before the IPO date.
Date:
Code:
=INDEX(STOCKHISTORY("AAPL", "12/31/2015", "09/06/2021",0,0),,1)
AAPL:
Code:
=STOCKHISTORY("AAPL", "12/31/2015", "09/06/2021",0,0,1)
PINS:
Code:
=STOCKHISTORY("PINS", "12/31/2015", "09/06/2021",0,0,1)
ROKU:
Code:
=STOCKHISTORY("ROKU", "12/31/2015", "09/06/2021",0,0,1)
The problem is that the STOCKHISTORY() function is not returning a consistent number of rows for each stock. AAPL returns all expected rows, but ROKU only returns 991 rows (it IPO'ed in 9/28/2017). The PINS formula only returns 601 rows, since it IPO'ed in 4/18/2019. So for example the very first row that I'm seeing looks like this:
Date | AAPL | PINS | ROKU |
12/31/2015 | 26.32 | 24.40 | 23.50 |
The PINS and ROKU values are completely incorrect, since they reflect the stock price on their IPO dates instead of 12/31/2015. Is there any way to ensure that all formulas will return the same number of rows so I don't have to also return the DATE field for every single stock? For all dates that don't have data, I'd be fine with just an NA() error for all dates before the IPO date.