Search code examples
google-sheetsgoogle-sheets-formulagoogle-finance

Is there a method for retrieving stock price data for the most recent open market day with google finance?


I am using google sheets, and would like to know the most recent stock pricing available for the date calculated. Currently i am using this,

=GOOGLEFINANCE("NASDAQ:TSLA", "close",EOMONTH(today(),-1))

If the date it returned is not an open market day, i receive an error. Which makes sense. I would like to return the most closest market open day however. Not sure if this is possible. Thanks in advance.


Solution

  • Try

    =index(sort(GOOGLEFINANCE("NASDAQ:TSLA", "close",today()-33,3),1,0),2,2)
    

    for the value on today minus 30 days or previous if the day was off