0

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

jy2da
  • 45
  • 5
  • 1
    Can you share with us what you have done so far and provide us with a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) (sample spreadsheet with the sample data and formula used and maybe the desired output)? – PatrickdC Aug 26 '22 at 05:27
  • Yes, please check out the link! – jy2da Aug 27 '22 at 06:53

1 Answers1

1

Convert the text to number using value() function.

You may use the formula below:

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

Output:

enter image description here

PatrickdC
  • 1,385
  • 1
  • 6
  • 17