Using Google Sheets and Pivot Tables

 

It is helpful to structure the google sheet in a manner that can easily be turned into a pivot table.  This table uses the following fields from the “all stocks” tab:

  • Ticker is self explanatory (i.e. GE = “General Electric”) – the unique exchange identifier for the stock.
  • Portfolio is the unique portfolio – there are 8 in total – they are numbered 1 to 8
  • If we were in a traditional “database” format, then the combination of the Ticker & the Portfolio number would be the “primary key” – all the other items are either values (price and shares) or attributes calculated from those values or the stock itself
  • Shares are entered into the spreadsheet; they rarely change except if there is a stock split (I have a few of these every year)
  • The price is a formula using google sheets
  • The sector, country, yield, and dividend level come from the “all stocks” page
  • The “momentum” is calculated based on the price level compared to the 52 week high
  • The annual income is calculated by taking the “amount” (which is price times number of shares) times the “yield”.  This is a useful figure and recommended for portfolios
  • Note that there are some exceptions – these are cash which has no attributes and must just be entered; and also CD’s which have an interest rate and a static value.  These items are in orange since they are entered manually

Consolidated_Portfolio_Shares

With the values in this format, you can now create a “pivot table” (which works just like the pivot tables in excel) which we then in turn will create the analytics pages for each portfolio which come next. Note that since these analytics are “pivot tables”, when you update the underlying data the tables automatically update without manual intervention.

Using My Consolidated Formula Model in Google Sheets

I moved the portfolios to Google Sheets to take advantage of Google’s ability to use financial functions like “price” by ticker so that my stock quotes could be updated with live data when you click on the spreadsheet. These sheets can also be shared with anyone (and it is free unlike Office 365).

I have been working with these sheets for a while to 1) simplify how they work 2) build them in such a way that I can “copy and paste” into other google spreadsheets 3) link the sheets together so that I only have to do selected work one time.

We are going to start with the “All Stocks” view because this page is crucial to understanding the entire model, including what can be linked to Google Sheets and what needs to be created and / or input from another source. Once this page is updated with key information, however, it can be used by all the other sheets and I only have to input data or do analysis one time and it automatically updates everything across all the portfolios.

The “ticker” symbol is used to derive values in google sheets using the “GoogleFinance” formula.  I manually added (one time since this page is essentially a central database for all the other portfolios).

For each stock I use the GICS classification system (used by Vanguard) which I describe here.  I map each of the stocks using this model as follows:

  • sector
  • industry group
  • sub industry
  • type (US or foreign)

“Yield” is something that the GoogleFinance formula doesn’t give you.  This is the dividend % for the stock and it is important information.  I look this up, manually, stock by stock, using google or yahoo finance or marketwatch.  Some of the ADR’s are harder to find.

I also classify stocks by “dividend level” based on yield which I made up and categorized stocks as follow:

  • >3.9% – very high
  • >2.7% – high
  • > 1.4% – medium
  • Less than 1.4% – low

I have a “description” field which is my all in summary of the stock.  This summary takes into account our original plan for the stock, its price against its 52 week high, potential as a takeover candidate, potential for a dividend cut, or any other information I feel is relevant.  I write this once for each stock in any of the 8 portfolios and propagate it through all the portfolios.

The price is derived by the GoogleFinance function and the 52 week high.  Then the stocks current price is compared to the 52 week high and shown as a percent.  The categories are:

  • If > 94% of 52 week high then “near high”
  • If > 90% of 52 week high then “doing OK”
  • If > 80% of 52 week high then “at risk” (and colored yellow by conditional formatting)
  • If less than 80% of 52 week high then “on watch” (and colored red by conditional formatting)

This is the single most important page and contains most of the logic used for analytics as well as the summary description of how that stock is doing “all in”.  In future posts we will review the other pages.

Using Google Sheets to Track Portfolios

Our portfolios took a hit in early February 2018 with the rest of the market.  Since then the portfolios have mostly rebounded as you can see below.  The results are slightly skewed between 2/9 and 2/25 because I found ~ $2000 in additional funds in portfolio 2 due to an error since IBB had split and I recently updated the cash counts for each portfolio which probably added another $1000 net across all 8.  But even with those items adjusted out, we are over $6000 above where we are right after the market drop.

These are long term portfolios and we expect variability, especially after a long bull market.

The portfolios are viewable within a consolidated portfolio tracker which is updated as the market moves via the formulas in Google Sheets. We also have analytics for each portfolio that shows pricing vs. 52 week high, dividend categorization, US / foreign, and sector data.

For each individual portfolio, they have their own google sheet which I just finished updating. Much of the analytics comes from the consolidated summary – I update a point of view on each stock there once and it “cascades” through all the sheets. I am now to the point where each sheet just has to update buys / sells, dividends, and cash balances and the rest comes from the main consolidated tracker.

Portfolio Review December 2017

For our portfolios I created a summary view in Google Sheets that updates automatically.  I also “save” performance every month or so (per above) so that you can see performance across time.  Note that this performance also includes additional investments and withdrawals so it isn’t “apples to  apples” but is still useful.  Generally we’ve gone up a lot in total since May along with the total market, and been pretty steady for the last couple of months.

Since moving portfolios to Google Sheets, I also centrally review “all stocks” and update yield (which cannot be determined via a Google Finance formula) manually.  At this time I also go through the stock news and review some of the stocks that may be performance outliers, as well as remove information on stocks that we no longer track (like TTM and SAVE).

Some of the stocks noted:

  • Dow Dupont (DWDP) – the merger has been completed.  The stock is likely to split into three separate companies.  I think we will sell now and take our gains and review the companies later that spin out.  This also saves us from having just a few fractional shares (Portfolio 3)
  • Juniper (JNPR) – there were rumors of a buyout for this network equipment maker.  This company is at risk of remaining independent due to the migration to the cloud.  It went up with the speculation (and back down when it didn’t occur).  Would like to get the sale premium or see it embedded in the stock price.  The problem is that if the sale doesn’t happen, the price usually goes back down (Portfolio 5D)
  • Siemens (SIEGY) – the European conglomerate has held up better than GE in the face of the power meltdown (companies are not buying turbines as often anymore they are moving to solar and wind).  They are likely to spin off their health care business in Europe.  May be a time to sell (Portfolios 3, 5D)

Google Sheets Integration

I have been using Google Sheets to update these portfolios and it has been an excellent experience.  I can share the spreadsheets with the beneficiaries and they can see a real-time view of their portfolios on any device (phone, PC, tablet) through Google Sheets.  The only minor updating item is the cash in the money market account which is a product of recent dividends.

It used to take me a long time to update each spreadsheet.  I had to do the following items:

  • look at the performance of stocks that were sold.  Now I use the “Google Finance” formula to get the current price of stocks that have been sold and I have it in a text statement embedded with the purchase and sales price for that stock
  • I don’t update the current prices for any stocks; that happens automatically

I try to centralize functions.  One item you can’t find via Google Finance is “dividend yield”.  I have a central sheet where I update yields once and then can copy that throughout all of the cells.  I need to copy a block of text into the spreadsheet so that a VLookup can be applied against the data, with the ticker being the primary key.  This also works for the current description of the stock’s status (commentary).