Using Google Sheets to Create a Portfolio Tracker

An overview of Google Sheets spreadsheet app as well as a portfolio tracker created with Google Sheets that automatically retrieves financial information for portfolio tracking and watchlist construction.

Google offers several productivity apps that allow users to create documents, spreadsheets and presentations and access them from any computer, anywhere in the world, for free. These apps are called Google Docs, Sheets and Slides. In this Spreadsheet Corner, we concentrate on Google Sheets. Google Sheets is an online spreadsheet app that lets you create and format spreadsheets and simultaneously work with other people.

Introduction to Google Sheets

Google lists these features in their Google Sheets explanation:

  • Import and convert Excel, .csv, .txt and .ods formatted data to a Google spreadsheet
  • Export Excel, .csv, .txt and .ods formatted data, as well as PDF and HTML files
  • Use formula editing to perform calculations on your data, and use formatting make it look the way you’d like
  • Chat in real time with others who are editing your spreadsheet
  • Create charts with your data
  • Embed a spreadsheet, or individual sheets of your spreadsheet, on your blog or website

Google Sheets works similar to Microsoft Excel in that you can enter formulas into the spreadsheet and perform functions accordingly. You can also pull data directly from Google Finance using the GOOGLEFINANCE function. Google Sheets offers such functions as spell check, insert charts, print, share online and insert formulas. While Sheets only offers a small portion of the capabilities that Microsoft Excel has, it is a viable alternative to Excel since the basic functions are all that most spreadsheet users would need. Would it work for individuals who use Excel to its fullest potential? Most likely not.

One useful feature is that sheets are automatically saved as you work, so you do not have to click save all the time. Also, Google Sheets lets users access their spreadsheets offline, even without Internet access (only available through the Google Chrome browser). Simply by clicking “enable offline editing,” users can work in their browser or pin files to their mobile device. Entering formulas is similar to Excel; users type in an equal sign and an open parenthesis followed by a formula and a closed parenthesis. Sheets recently added an autocomplete function, which offers suggestions as you type. Users can minimize or maximize the help box by clicking F1. Also similar to Excel, Google Sheets supports several tabs in one sheet and tabs can be linked to one another. Google Sheets offers several different add-ons as well as apps for iPad, Android and iPhone. It is possible to add array formulas or import data from various structured data types, including XML, HTML, CSV, TSV, RSS and ATOM XML feeds. Users can also perform queries written in the Google Visualization API Query Language.

I found that when I tried to open a Google Sheets document created on my PC on my iPad, I couldn’t open it easily. It was at that time that I realized you need to download the Google Sheets iPad app in order to use it correctly, but it still didn’t open with the exact same formatting. As I mentioned before, Google Sheets doesn’t have all the formulas that Microsoft Excel contains but there are several formulas that overlap. I think that Google Sheets is a viable free alternative for those attempting basic Excel-related functions, and improvements continue to be made to the program.

We used Google Sheets to create a rudimentary portfolio tracker. This is a simple portfolio tracking spreadsheet that allows users to input current equity holdings and keep track of their current values and track securities through a watchlist.

The Spreadsheet

CI’s Portfolio Tracker with Google Sheets contains two different tabs: Portfolio and Watchlist. Cells highlighted in yellow require manual input, while everything else will be calculated accordingly. CI’s Portfolio Tracker with Google Sheets will appear once you click this link.

In order to have your own copy that you can edit you have several options. The first one requires you to sign in to Google, then click File, and Make a Copy. You will then officially have your own copy of the Portfolio Tracker. In order to access the spreadsheet at a later date, you will sign into Google and click the grid-like figure in the top right-hand corner of your page. This will show you choices such as: Calendar, Finance, Maps, News, Gmail and Drive. Click “Drive.” This is where you will be able to access your copy of the spreadsheet.

If you do not have a Google account, once you click the Google spreadsheet link above to open the document, click File, Download As. You will see several options including: Microsoft Excel, OpenDocument format, PDF document, comma-separated values (CSV), tab-separated values (TSV), or web page. Based on your preference, click any of these options to download your own copy of the CI Portfolio Tracker with Google Sheets and save to a location of your choosing

On the Portfolio tab (Figure 1), you begin by inputting your current holdings by typing in their ticker symbols in column B. Next you input the date at which you bought the holding in column C, the commission fees you were charged in column D and the number of shares you purchased in column F.

In column A, the company’s name will appear that corresponds with the ticker to its right. Column G calculates the total cost of the trade. The formula you will see in cell G5 is:

=IF($E5=““,”“,($E5*$F5)+$D5

The purpose of the IF function here is to instruct the sheet that if cell E5 is blank, then cell G5 should be blank as well. I included the IF function throughout the whole spreadsheet simply because I wanted the spreadsheet to appear more “clean.” The goal was to program the sheet so that users wouldn’t have to drag cells down rows and try to merge formatting. For example, say you didn’t input a purchase price in cell E5, and the total cost calculation formula in cell G5 was simply:

=($E5+$F5)+$D5

Without the IF function, you would see $0.00 in G5. Although this isn’t misleading, it is somewhat “cluttered” when the formulas are carried down throughout a blank spreadsheet. All calculated cells would display #INVALID_DATA, #ERROR or #VALUE until you input your holdings. You can see how this works by clicking on any blank cell under the column heading row. Each cell has the formula input already, so you don’t have to copy any formulas down the rows, and using the IF function keeps the cells blank until data is present. This is displayed in Figure 2.

The IF function is defined as:

=IF(logical_text, [value_if _true], [value_if_false])

If the logical text is determined to be true, then the “value if true” will result. If the logical text is determined to be false, then the “value if false” will result. In this case, if the referenced cell is blank (“ “), a blank should appear in the destination cell, and if the referenced cell is not blank, the formula after the final comma should be calculated in the destination cell.

Dollar signs are used in formulas to lock in a cell reference. When you copy and paste an Excel formula from one cell to another, the cell references change, relative to the new position. The “$” symbol is placed before the column reference to let Sheets know to change the row number when the formula is copied down, but not the column reference. This formula also applies to Microsoft Excel.

Column H is “Average Cost/Share.” The formula in cell H5 is as follows:

=IF($E5=““,”“,(($E5*$F5)+$D5)/$F5)

Again we are using the IF function to remove error messages when a purchase price hasn’t been input yet. The calculation multiplies your purchase price by the number of shares purchased, adds the commission fees and divides by the number of shares purchased to arrive at an average cost per share value.

Column I shows the market value of your holdings. The formula in cell I6 is:

=IF($A5=““, ““,($J5*$F5))

To prevent the error messages from appearing before the contents of cell A5 are input, the IF function is used. The market value is determined by multiplying the current price of the equity by the number of shares you purchased.

Column J contains the current price for each holding. Quotes may be delayed up to 20 minutes. The formula in cell J5 is:

=IF($A5=““,”“,(GOOGLEFINANCE($B5, “price”)))

The IF function was used again, but we also have a different type of formula in this cell. The GOOGLEFINANCE function tells the Google Sheet to pull data from Google Finance website. The syntax given by Google for Sheets is:

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

The first part of the formula requires the ticker symbol. In the example above, we substitute $B5 for “ticker” because each row will reference a different holding. So the sheet is programmed to reference cell B5 as the ticker in row 5 and B6 as the ticker for row 6, etc.

The “attribute” part of the syntax requires that users choose a specific attribute they are trying to access. Examples would be: price, high, low, volume, and market cap among other options. For a list of attributes and more information regarding them visit:

https://support.google.com/docs/answer/3093281?hl=en

The last three parts of the syntax are optional and they are not items that we use in this spreadsheet.

Column K displays the equity’s opening price for the day. The formula in cell K5 is:

=IF($B5=““,”“,(GOOGLEFINANCE($B5, “priceopen”)))

The IF function was used so ERROR values wouldn’t be displayed before a ticker symbol was input into the sheet. The GOOGLEFINANCE part of this formula references the ticker symbol in cell B5 and pulls in the data for the attribute “priceopen.”

Column L displays the intraday high corresponding to the ticker input in column B. The formula in cell L5 is:

=IF($B5=““,”“,(GOOGLEFINANCE($B5, “high”)))

The IF function was used to remove error values until a ticker was input in column B. Then the formula uses the GOOGLEFINANCE function by referencing the ticker symbol and the “high” attribute.

Column M displays the intraday low. In cell M5, you will see the formula:

=IF($B5=““,”“,(GOOGLEFINANCE($B5, “low”)))

The IF function was used to ensure that an error value wouldn’t be displayed if no ticker symbol is input into column B. Then the GOOGLEFINANCE function was used to return an intraday low figure once a value was input for the ticker in column B.

Column N displays the volume. In cell N5, you will see the formula:

=IF($B5=““, ““,(GOOGLEFINANCE($B5, “volume”)))

This formula uses the IF function to ensure that if no ticker has been input into the respective B column, no error will be displayed. Then the GOOGLEFINANCE function references the ticker in cell B5 and the attribute “volume.”

Column O displays a given equity’s 52-week high. In cell O5, you will see the formula:

=IF($B5=““,”“,(GOOGLEFINANCE($B5,”high52”)))

The IF function was used to prevent an error value from displaying if there is no ticker in the corresponding row. The GOOGLEFINANCE function references the ticker symbol in cell B5 and defines the attribute “high52,” or 52-week high.

Column P displays the security’s 52-week low. The formula in cell P5 is:

=IF($B5=““,”“,(GOOGLEFINANCE($B5,”low52”)))

The IF function was used to prevent error values from displaying before a ticker is input into the respective row. The GOOGLEFINANCE function references the ticker symbol in the row and provides a 52-week low figure.

Column Q provides users with the price-earnings ratio for a given security in their portfolio. The formula in cell Q5 is:

=IF($B5=““,”“,(GOOGLEFINANCE($B5, “pe”)))

The IF function was used to prevent an error value from displaying until the ticker symbol is input. If there is no ticker symbol, the cell will remain blank. The GOOGLEFINANCE function references the ticker symbol in column B for the row and then returns the “pe,” or price-earnings attribute.

Column R provides users with an earnings per share figure for a given ticker. The formula in cell R5 is as follows:

=IF($B5=““,”“,(GOOGLEFINANCE($B5, “eps”)))

The IF function was used to prevent an error value from displaying until the ticker symbol is input. If there is no ticker symbol, the cell will remain blank. The GOOGLEFINANCE function references the ticker symbol input in the corresponding row, and then returns an earnings per share figure.

Column S displays the daily change of a given security in terms of percentage. The formula in cell S5 is:

=IF($B5=““,”“,(GOOGLEFINANCE($B5, “changepct”)))

The IF function tells Google Sheets that if there is no ticker symbol in cell B5, then the cell S5 must remain blank. This prevents the cell from displaying an error message until we have input the necessary information. The GOOGLEFINANCE function references the ticker symbol in the corresponding row and then provides the attribute “changepct” to return a percentage change in price for the security since the previous trading day’s close.

Watchlist

The Watchlist tab of our portfolio tracker is where you can enter in stocks, mutual funds or ETFs that are on your radar screen, but are not part of your actual investment portfolio. When you click the Watchlist tab, you will see today’s date displayed at the top, along with three different indexes: the Standard and Poor’s 500 index, Wilshire 5000 Total Market Index (full cap) and the NASDAQ 100 composite. Columns C, D and E give the current price and daily change in terms of dollars and percent. Ticker symbols that users want to include on their watchlist are entered below the indexes in the cells highlighted in yellow. When ticker symbols are input into column A, all the corresponding columns will populate accordingly (Figure 3).

The Watchlist tab includes some of the same formulas from the Portfolio tab, except that the calculated cells reference column A for the ticker symbol instead of column B. However, there are a couple of formulas that weren’t included on the Portfolio tab: Current Price as % of 52-Week High and Current Price % Away from 52-Week Low.

In column N you will see the stock’s current price as a percentage of its 52-week high. The formula in cell N10 is as follows:

=IF($A10="", "", ($C10/$L10))

The formula uses the IF function to ensure that the cell will be left blank until a ticker symbol is input into cell A10. The second set of parentheses addresses the question, “What should the formula do if there is a ticker symbol input into cell A10?” In order to calculate what percentage the current price is of the 52-week high, we use a simple formula:

(Current Price)/(52-Week High Price)

For example, if a security’s current price is $94 and its 52-week high price is $123, $94 represents 76.4% of $123.

In column O you will see the stock’s current price compared to its 52-week low as a percentage. Cell O10 contains the formula:

=IF($A10="", "", ($C10/$M10)-1)

The IF function lets the formula know that if there is no value in cell A10 for a ticker, we want cell O10 to display a blank. Once the ticker symbol is input, then the formula will calculate how far away the current price is from the 52-week low price, using the formula:

(Current Price)/(52-Week Low Price)

Conclusion

CI’s Portfolio Tracker with Google Sheets is a simple and easy-to-use portfolio tracker that allows you to keep track of your current holdings as well as create a watchlist. This spreadsheet introduces users to Google Sheets, lets them know some of the functions and features that the program has to offer, and a free basic tool for investors. You can find plenty of further information regarding Google Sheets online.

Discussion

Leamon Lorance from IN posted over 11 years ago:

A question if I may: How to get the value from say A1 into another cell. All I can get is the formula? Thanks leamon


Jackie Mcclellan from IL posted over 11 years ago:

Which page are you? the Portfolio tab or the Watchlist? On both tabs everything is driven from the columns that are in yellow, those are where you input manual information. So if you're talking about the Portfolio tab - to change the company name in cell A1, you'd have to change the ticker in cell B1.


GoNavy64 from VA posted over 11 years ago:

BRAVISSIMO effort. This is the first application I have seen that links the power of automatic updating with the capabilities of a spreadsheet to insert tailored, user selected info such as "buy under price", and then use the user information to do computations with the Googlefinance info. Essentially you have now made watchlists really functional by allow the user to keep the basic format on a stock, i.e. to watch it, while adding user relevant information and notes. No one else does this that I know of. A few have one user information column, but that is just about useless. The key to this app is linking to googlefinance for auto update. Thank you so much. Great tool.


Jackie McClellan from IL posted over 11 years ago:

Thank you! I'm really glad that you like the spreadsheet :) I appreciate the positive feedback.


Larry Roles from CA posted over 11 years ago:

What convention for preferred stock symbols does Google use? I tried (example) O-PF (which is the symbol for Reality Income preferred series F) and the spreadsheet does not recognize that configuration


Steven Johnson from MN posted over 11 years ago:

If I leave my page up and running during the day are the GOOGFINANCE reference's updated? If not how can you refresh them?


Wayne Thorp from IL posted over 11 years ago:

When the sheet it open, and the market is open, the data will update. Otherwise, the data will default to the last trade until the market is open again.


Larry Mortimer from CA posted over 11 years ago:

Wow, this auto updating feature makes me rethink my whole setup.


Michael from CA posted over 11 years ago:

Hi, All. New member here. Many thanks to Jackie for the wonderful job she did on the Google Sheets Portfolio Tracker. I've created a modified version, which I'm happy to share with everyone. As you'll see, my Portfolio Tracker is really more of a Positions Tracker, in that I don't track the full value of my holdings. (I use my broker's Website for that.) Instead, I use the tracker as my daily "dashboard" for monitoring price changes of my stocks, ETFs, etc., as well as those of my Watchlist items. On the Portfolio tab, I added a CAGR (i.e., Annualized Return) column (column I), which I find very useful for "normalizing" positions that I've held for a long time against positions that I bought only recently. I added a column showing a manually-set Low Target for each position (col. J) and a column showing a manually-set High Target for each position (col. K), with conditional formatting so that if the Current Price falls below the Low Target, the cell background turns red; if the Current Price rises above the High Target, the cell background turns green. On the Watchlist tab, I added a section to track my sold positions, showing my Sold Price (col. I) and the Current Price as a percent of my Sold Price (col. H). (Generally speaking, in my investing world, when col. H rises above 100%, it's time to consider buying that position again!) The Position Manager Template can be found at the URL below. I would be delighted to hear any comments you may have, especially ways to improve it! https://docs.google.com/spreadsheets/d/1hB8WydyfUUqcgaEOfUHBBkSnHgI3KmZq4vdGMkb8FNs/edit#gid=1105633901


Brad from NY posted over 10 years ago:

Like the concept, but don't want to put my financial information in the clud. Downloading to XL gives a nonfunctional spreadsheet. Oh well...


Donna Christensen from CT posted over 10 years ago:

When I 'insert' a row to add a stock, the data feed does not work. I would like to have my list alphabetical by symbol and inserting seems logical.What should I do?


Jackie McClellan from IL posted over 10 years ago:

You could input the symbols in alphabetically, or if you already have them in you could try highlighting the rows that have symbols in them and sorting the rows by a specific column. You could also try copying a row and then inserting (just inserting will insert a blank row).


Donna Christensen from CT posted over 10 years ago:

Thank You! Cut and Paste worked.


Jared Bessert from WI posted over 8 years ago:

When you stopped printing CI I stopped reading it. I've read a few selected online articles that had a link to download a PDF. I then printed and read the article. Now, it appears you do not provide a PDF download or print feature. Will you bring these printing and PDF output features back? -- Jared Bessert


D Shaffer from OH posted over 8 years ago:

I have been using the "Portfolio Manager" at Morningstar for my total asset portfolio. In addition to stock tickers, it provides for Bonds and Cash entries. However, I found that I have to pretend that my CD's are "bonds." And now, I have run into a limitation where Morningstar's app prevents the latest additions because I have "exceeded the number of bonds" allowed. I really would prefer not to create an additional portfolio to manage. Thus, I have been looking to manage everything in a spreadsheet without having to buy one of the online software packages. This Portfolio Tracker does not provide adequate asset types for me. Can you suggest alternative(s)?


Robert Baran from IL posted over 8 years ago:

Here are two articles that were written for Computerized Investing regarding portfolio tracking: Online-based: http://www.aaii.com/computerized-investing/article/the-top-online-portfolio-trackers-2017 Software-based: http://www.aaii.com/computerized-investing/article/the-top-portfolio-management-software-2016 Hopefully, this helps!


D Shaffer from OH posted over 8 years ago:

Robert, Thanks for the post. I found it helpful, to the extent that I believe I will continue to use Morningstar.com and upgrade to Premium subscription. Dave


You need to log in as a registered AAII user before commenting.
Create an account

Log In

Get your free copy of our special report analyzing the tech stocks most likely to outperform the market.

Download the FREE Report Here: