Google-sheets – How to pulling in historical daily trade volume data in Google Sheets with Google Finance

formulasgoogle sheetsgoogle-finance

If I try =GOOGLEFINANCE(A1,"volume",A2) where A1 is the stock code and A2 is the date I'm querying, it comes back printing 'date' and 'volume' on one line as headers and then the data on the line below. Is there a way to have this formula printing on each line without the headers?

e.g. GOOG

A1  13/06/20  B1 daily volume  
A2  12/06/20  B2 daily volume
A3  11/06/20  B3 daily volume

I'm just trying to build the formula that can give the data for B1,B2,B3 etc and drag it down so the data is on each line querying the respective date in column A.

What formula do I need to use?

Best Answer

It's rather easy to get a list of data: just add the number of days as a parameter, e.g.

=GOOGLEFINANCE(A1,"volume",A2,30)

Specifying start and end date is also possible, see the documentation.

enter image description here

If you want it for specific (non-consecutive) dates, I'd suggest to use VLOOKUP or some other query method. An example:

The Finance formula is now =GOOGLEFINANCE(A1,"volume",MIN(A2:A100),MAX(A2:A100)) and the second column is =VLOOKUP(A2+TIME(16,0,0),D:E,2,FALSE); adding 16 hours is one possible way to make sure it matches the timestamp in the 'Date' column.

enter image description here