How to Use the GOOGLEFINANCE Function in Google Sheets

You can track your financial portfolio in Google Sheets using the GOOGLEFINANCE function.

The GOOGLEFINANCE function allows you to retrieve live and historical stock prices, as well as currency exchange rates, directly from the Google Finance website. With this information, you can create a personalized financial portfolio tracker in Google Sheets.

However, do not rely solely on this function for tracking your investments. Numerous websites offer tools to monitor stock movements more comprehensively. Use this function for informational purposes only and not for making trading, financial, or investment decisions.

Before using the function, review the following points.

Things to Know Before You Start Using the GOOGLEFINANCE Function

You may encounter the function being unresponsive or returning #N/A errors due to various reasons:

  • Incorrect Ticker: Ensure that the ticker symbol is correct. If a previously working ticker stops functioning, it may be due to internal errors beyond your control or changes in the listed company’s ticker.
  • Market Information: The GOOGLEFINANCE function retrieves stock data directly from the Google Finance website.
  • Data Delay for Current Prices: When fetching real-time data, there may be a delay of up to 20 minutes, as indicated by a notification bar at the bottom of the sheet.
  • Exchange Codes and Delays: You can find more details about exchange codes and delay times in the Google Finance Data Listing and Disclaimers.

GOOGLEFINANCE Function: Syntax, Arguments, and Examples

Syntax:

GOOGLEFINANCE(ticker, [attribute], [start_date], [end_date|num_days], [interval])

    Ticker

    In this syntax, the argument “ticker” represents the ticker symbol of the security to consider to get live or historical data.

    You should use both the exchange symbol and ticker symbol for accurate results and to avoid the GOOGLEFINANCE function to judgement and to choose one for you.

    Example:

    =GOOGLEFINANCE("NSE:RELIANCE")

    This returns the real-time price quote for RELIANCE from the National Stock Exchange of India (NSE), as “price” is the default attribute.

    Currency Exchange Rates:

    To get currency exchange rates, use the “CURRENCY” prefix followed by the currency codes.

    Example:

    =GOOGLEFINANCE("CURRENCY:USDINR")

    This formula returns the exchange rate for 1 USD to INR.

    For a list of currency codes, visit the ISO 4217 Wikipedia page.

    Attribute for Real-Time Stock Data

    For real-time stock data, you can specify one of the following attributes in the GOOGLEFINANCE function:

    AttributeDescription
    priceThe latest stock price, with a delay of up to 20 minutes.
    priceopenThe stock price at market open.
    highThe highest price reached during the current trading day.
    lowThe lowest price recorded during the current trading day.
    volumeThe total number of shares traded on the current day.
    marketcapThe company’s market capitalization.
    tradetimeThe timestamp of the most recent trade.
    datadelayThe delay duration of the real-time data feed.
    volumeavgThe average daily trading volume.
    peThe ratio of the stock’s price to its earnings per share.
    epsThe earnings generated per share of the stock.
    high52The highest price of the stock over the past 52 weeks.
    low52The lowest price of the stock over the past 52 weeks.
    changeThe price change since the previous day’s close.
    betaThe stock’s volatility relative to the market.
    changepctThe percentage change in price from the previous trading day’s close.
    closeyestThe stock’s closing price on the previous trading day.
    sharesThe total number of shares currently outstanding.
    currencyThe stock’s pricing currency. (Note: Currency does not support attributes like high or low as it lacks trading sessions.)

    Example:

    =GOOGLEFINANCE("NSE:RELIANCE", "high")

    This formula returns the highest price RELIANCE reached during the current trading day.

    You can also input the ticker symbol and attribute in separate cells and reference them in the formula. For instance, if cell A1 contains NSE:RELIANCE and cell B1 contains high, you can write:

    =GOOGLEFINANCE(A1, B1)

    Note: The function is case-insensitive.

    Historical Stock Data: Attributes, Start Date, End Date, and Interval Parameters

    For historical data, you can specify additional arguments like start_date, end_date, and interval.

    AttributeDescription
    openThe stock’s opening price for the given date(s).
    closeThe stock’s closing price for the specified date(s).
    highThe highest price recorded on the specified date(s).
    lowThe lowest price recorded on the specified date(s).
    volumeThe total number of shares traded for the specified date(s).
    allIncludes all of the above data points.

    Ensure your formula has enough blank rows and columns to display all results, including headers and timestamps.

    Example:

    =GOOGLEFINANCE("NSE:RELIANCE", "open", DATE(2018,6,1), DATE(2018,6,10), "DAILY")

    This formula returns the opening prices of RELIANCE from June 1, 2018, to June 10, 2018.

    Displaying historical data using the GOOGLEFINANCE function in Google Sheets

    In this example, the interval is set to "DAILY". You can modify it to "WEEKLY" if you prefer weekly data instead.

    Explanation of the Syntax:

    • ticker: "NSE:RELIANCE"
    • attribute: "open"
    • start_date: DATE(2018,6,1) (You can also write it as "2018-06-01" in ISO 8601 format.)
    • end_date: DATE(2018,6,10) (Alternatively, use "2018-06-10" in ISO 8601 format.)
    • interval: "DAILY" (Use "WEEKLY" for weekly intervals.)

    If you prefer, instead of specifying an end_date, you can define the number of days from the start_date to retrieve data.

    Attributes for Mutual Fund Data in GOOGLEFINANCE Function

    AttributeDescription
    nameThe name of the mutual fund.
    closeyestThe closing price from the previous trading day.
    dateThe date when the net asset value (NAV) was reported.
    returnytdThe return on investment since the beginning of the year.
    netassetsThe total value of the fund’s net assets.
    changeThe difference between the most recent reported NAV and the one immediately preceding it.
    changepctThe percentage difference between the most recent and previous NAVs.
    yieldpctThe distribution yield, calculated as the sum of the last 12 months’ income distributions (dividends and interest) and NAV gains, divided by the NAV at the end of the previous month.
    returndayThe total return over one day.
    return1The total return over one week.

    Example Formula:

    =GOOGLEFINANCE("MUTF_IN:EDEL_LARG_MID_1D0HAMC","date")

    Additional Tips

    Using Multiple Tickers in Real-Time Stock Data with Lambda

    The GOOGLEFINANCE function is an array formula, even though it returns a single output for real-time stock data. This means you cannot directly specify multiple ticker symbols to get their real-time stock data all at once.

    For example, if you want the real-time “price” of the tickers listed in range A2:A, you can enter the following formula in cell B2 and drag it down:

    =GOOGLEFINANCE(A2, "price")

    Alternatively, if you have multiple tickers in a column and want to use them all without dragging the formula down, you can use the MAP and LAMBDA functions:

    =IFNA(MAP(A2:A, LAMBDA(ticker, GOOGLEFINANCE(ticker, "price"))))
    Using multiple tickers in the GOOGLEFINANCE function in Google Sheets to fetch real-time stock data

    Removing Headers and Columns in Historical Data from GOOGLEFINANCE Output

    Consider the following formula:

    =GOOGLEFINANCE("NSE:RELIANCE", "close", "2024-12-01", 5)

    This formula returns the closing price of the stock starting from the specified date and for the next 5 days. To omit the header row from the output, you can use the following formula:

    =LET(data, GOOGLEFINANCE("NSE:RELIANCE", "price", "2024-12-01", 5), CHOOSEROWS(data, SEQUENCE(ROWS(data)-1, 1, 2)))

    To select the price column, wrap the formula with CHOOSECOLS as follows:

    =CHOOSECOLS(LET(data, GOOGLEFINANCE("NSE:RELIANCE", "price", "2024-12-01", 5), CHOOSEROWS(data, SEQUENCE(ROWS(data)-1, 1, 2))), 2)

    This formula will return only the price data without the header row.

    Resources

    Prashanth KV
    Prashanth KV
    Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

    Compare Two Tables for Differences in Excel

    To compare two tables with similar data for differences, you can use the XLOOKUP...

    Calculate Weighted Average in Pivot Table in Google Sheets

    You can calculate a weighted average in a Pivot Table using a custom formula...

    Summarize Data and Keep the Last Record in Google Sheets

    In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

    How to Retrieve the Last Record in Each Group in Excel

    As part of data analysis, you may need to retrieve the last record from...

    More like this

    Calculate Weighted Average in Pivot Table in Google Sheets

    You can calculate a weighted average in a Pivot Table using a custom formula...

    Summarize Data and Keep the Last Record in Google Sheets

    In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

    Filter Data with Multi-Select Drop-Downs in Google Sheets

    If you've started using multi-select drop-downs in Google Sheets, you may encounter challenges when...

    3 COMMENTS

      • Hi, SPH,

        It’s not possible as GoogleFinance itself is an array formula. If you use the start date and end date arguments, the formula would return an array result.

        So in your case, you need to copy-paste the formula down.

    LEAVE A REPLY

    Please enter your comment!
    Please enter your name here

    This site uses Akismet to reduce spam. Learn how your comment data is processed.