The GOOGLEFINANCE function in Google Sheets is a powerful tool that enables users to effortlessly pull stock market data directly into their spreadsheets. It allows access to both current and historical information, making financial analysis easier and more efficient.
Syntax
GOOGLEFINANCE(ticker, [attribute], [start_date], [end_date], [interval])
- ticker: The stock symbol for the security (e.g., “GOOG” for Alphabet Inc.).
- attribute: (optional) The specific data point to retrieve (e.g., “price” for current stock price, “volume” for trading volume).
- start_date: (optional) The date from which to start fetching historical data.
- end_date: (optional) The date until which to fetch historical data.
- interval: (optional) Frequency of data retrieval, such as “DAILY”.
Example #1
=GOOGLEFINANCE("GOOG", "price")
This function retrieves the current stock price of Alphabet Inc. The output might look like $2,800.00.
Example #2
=GOOGLEFINANCE("AAPL", "volume", DATE(2022, 1, 1), DATE(2022, 1, 31))
This example fetches the trading volume of Apple Inc. from January 1 to January 31, 2022. The result could return values like 10,000,000.
Example #3
=GOOGLEFINANCE("MSFT", "price", DATE(2021, 6, 1), DATE(2021, 6, 30), "DAILY")
This function gets Microsoft Corp’s daily closing prices for June 2021, returning a list of daily prices for that month.
Error handling
- VALUE!: Appears when an invalid value or parameter is used, such as a non-existent stock ticker.
- N/A: Indicates that the requested information is not available, often due to incorrect ticker symbols or the specific attribute not being supported.
- REF!: Indicates that a reference is not valid, which may occur if the function is trying to access a cell that contains an error.