15
votes

I'm having trouble stopping the googlefinance function on a specific date to use "that" specific exchange rate to convert currency from GBP to EUR.

Here is my formulae: =Finance!B4*GOOGLEFINANCE("CURRENCY:GBPEUR","price",date(2017,15,11))

Here is the error: When evaluating GOOGLEFINANCE, the query for the symbol: 'CURRENCY:GBPEUR' returned no data.

I've looked at other solutions on SO but none to avail. I've actually added "date" and "price" to my formulae from other solutions. Like so:- Solution 1

6

6 Answers

38
votes

First of all, date(2017,15,11) means the 11th day of 15th month of the year, so you'll need to swap the month and day.

Secondly, historical data queries, such as

=GOOGLEFINANCE("CURRENCY:GBPEUR", "price", date(2017,11,15))

return a table with columns and headers.

Date                Close
11/15/2017 23:58:00 1.1163

From the way you use this formula, I see you just want the exchange rate. Wrap the function in index(..., 2, 2) to get the second cell in second row.

=index(GOOGLEFINANCE("CURRENCY:GBPEUR", "price", date(2017,11,15)), 2, 2)
1
votes

your issue is (was) that you trying to force data for non-existing 15th month. syntax for DATE is:

=DATE(YEAR(), MONTH(), DAY())

so the full formula should be:

=Finance!B4*INDEX(GOOGLEFINANCE("CURRENCY:GBPEUR", "price", DATE(2017, 11, 15)), 2, 2)

alternatives are:

=Finance!B4*INDEX(GOOGLEFINANCE("CURRENCY:GBPEUR", "price", "15/11/2014"), 2, 2)

=Finance!B4*INDEX(GOOGLEFINANCE("CURRENCY:GBPEUR", "price", DATEVALUE("15/11/2014")), 2, 2)

=Finance!B4*INDEX(GOOGLEFINANCE("CURRENCY:GBPEUR", "price", A1), 2, 2)

where A1 contains valid date

1
votes

Here's my version of this formula.

Where B3 should be valid date.

=index(GOOGLEFINANCE("CURRENCY:USDCNY", "price", B3), 2, 2)

PS. I'm not sure why, but when I specify the 15-Dec-2018 the formula shows me an error. All other dates are work correct.

1
votes

Just to make sure it's known, the , operator isn't used in today's Google Sheets, so the correct expression to avoid a parser error would be (in your case):

=index(GOOGLEFINANCE("CURRENCY:GBPEUR"; "price"; date(2017;11;15)); 2; 2)
0
votes

15-Dec-2018 is a Sunday - hence the error. You can add a -2 or +2 because the error will also pop up on Saturdays. I prefer the -2

0
votes

:D Nothing works. No matter what date I insert or address from a cell, no matter what currency pair I declare, what price I insert or address from a cell, with or without index → it returs with "analysis error". I love it when this happens.