On Google Spreadsheet how can you query 'GoogleFinance' for a past exchange rate?

前端 未结 7 642
情话喂你
情话喂你 2020-12-24 00:33

I\'d like to know if it is possible to query a past exchange rate on Google Spreadsheet.

For example; using formula =GoogleFinance(\"CURRENCY:USDEUR\")

相关标签:
7条回答
  • 2020-12-24 01:26

    You may notice that GOOGLEFINANCE will return N/A for some dates, this is because the date is a day off (usually a weekend), what you can do is to get the last working from the specified date, e.g. Jun 21st 2015 is Sunday, so you should request the rate for Jun 19th (Friday), you can do this via WORKDAY function as was suggested here:

    WORKDAY("6/21/2015"+1,-1)
    

    So, the resulting formula will look something like that:

    INDEX(GoogleFinance("CURRENCY:USDRUB", "price", WORKDAY("6/21/2015"+1,-1),1),2,2)
    

    Additionally, you want to get the exchange rates for future dates you can additionally check if the date is in the future and if so, just use the today date:

    WORKDAY(IF("6/21/2099">TODAY(),TODAY(),"6/21/2099")+1,-1)
    
    0 讨论(0)
提交回复
热议问题