Search code examples
google-sheetsspreadsheetfinancegoogle-finance

Finding the average of monthly closing price on Google Finance


With Google Finance, I'm trying to calculate the 12-month moving average of a ticker. For example, I want to retrieve end-of-month closing price for a ticker for the last 12 months and find the average of these values.

I've tried to refer to this question: GoogleFinance: Get History By Month

Though I was able to retrieve the end-of-month closing prices, it wasn't letting me calculate the average of these values. I think this is because all the numbers are formatted as texts.

Any idea on how I can accomplish this?

EDIT: here is what I have so far and hopefully this provides a better sense of my desired outcome.

https://docs.google.com/spreadsheets/d/1Mf9wVli7ofJBGTaNTVrfGREMAwDNQwwO6nZWDwyGCbM/edit?usp=sharing


Solution

  • Convert the text to number using value() function.

    You may use the formula below:

    =average(arrayformula(value(B2:B14)))

    Output:

    enter image description here