0

I am using a function in Google Sheets that outputs a 2 column array. I want to use data from only the second column of that array to calculate a figure. But I would like to do this all in a single cell and do not want to have to output the array, and then use a separate cell to calculate from the figures in that array.

I can already get the output I need by pasting the array on another sheet within the same spreadsheet, but this is a messy solution.

This is the function I am using:

=GOOGLEFINANCE("eurusd","close","6/1/2019","6/13/2019")

It outputs the date and price data in a 2x13 array I want to use the second column of that array (less the heading) to sum and divide by 12 to take an average of the closing rates over that period. But I would like to do it all in a single cell without having to see the array.

I want to use the second column of that array (less the heading) to sum and divide by 12 to take an average of the closing rates over that period. But I would like to do it all in a single cell without having to ever see the array.

player0
  • 124,011
  • 12
  • 67
  • 124
Daniel
  • 1

1 Answers1

0

to isolate it you can do this:

=QUERY(GOOGLEFINANCE("EURUSD", "close", "1/6/2019", "13/6/2019"), 
 "select Col2 offset 1", 0)

0

and then just average it like:

=AVERAGE(QUERY(GOOGLEFINANCE("EURUSD", "close", "1/6/2019", "13/6/2019"), 
 "select Col2 offset 1", 0))

0

player0
  • 124,011
  • 12
  • 67
  • 124