0

I am quite new when it comes to Google Sheets, but I just created a function which gets me the Amazon stock price, see below:

var temp = '=INDEX(GoogleFinance("AMZN", "CLOSE", DATEVALUE(A5)),2,2)'; 

It works but the problem is, that I want to be flexible when it comes to the date (DATEVALUE). Currently, I have a date in my cell A5, but I actually have a IF statement, which uses the variable i. So, preferably it should at the end look like Ai whereas of course i can be 7 or 15 or whatever number.

How can I achieve that?

I already tried A + i but that did not work.

0
1

Try

var temp = '=INDEX(GoogleFinance("AMZN", "CLOSE", DATEVALUE(A'+ i +')),2,2)'; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.