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.

Stock Selections Completed, SNAP and the Summer Bull Market

We recently completed our stock buying for the fall of 2017.  We do the stock buying and matching in the fall so that beneficiaries can have the summer to make some money in order to do the match.

It is interesting that of the 6 stocks (and one ETF, IAU or gold) on the list, no one took Snapchat (SNAP).  This is interesting because while it is popular with many of the beneficiaries (they use it), they can segregate whether something is useful or whether it may be a good investment. I had Snapchat on the list because I felt that it had been beaten down by bad sentiment and poor results and because it was burning cash BUT that this also created the opportunity for a turn upward (may be at the bottom).  In the past I’ve been hesitant to put up stocks that are tied to products that the beneficiaries may use day to day because I didn’t want that to bias the selection process but it turns out I was wrong.

With Google Sheets it is much easier to track the portfolio real time.  I have a summary sheet set up like the picture in this post and I can just glance at it on my phone from the google sheets app.  I take snapshots of the values in each portfolio every month or so in order to see simple trends over time.

You can see our summer bull market in the results, although you need to mentally factor out the impact of $11,700 in contributions and $6000 in withdrawals across the period (net inflows of $5700).  Thus based on some simple math above, across the portfolio we saw an increase of $154,073 – $136,791 = $17,282 and then you take out the net inflows of $5700 to get a net increase of $11,582 divided by our base of $136,791 from about 6 months ago which is 8.4% and if you roughly double it (to get annual performance) you see annualized performance of roughly 17% in the portfolio during essentially the summer and most of the fall of 2017.

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).

New Google Sheets Analytics – Sector, US / Foreign, and Dividend Views

I really enjoy working with Google Sheets and the Google Finance portfolio functions.  Recently I moved tracking from excel to Google Sheets and sent links to the beneficiaries so that when they open the file, the stocks update automatically.  I made 8 of these sheets and sent them to each individual beneficiary, and learned a lot along the way.

There still is some manual and redundant work done within each spreadsheet and for me to track performance, I had to open each sheet individually.  Thus I went to work and built a summary sheet that taps into each of the 8 individual portfolios and shows performance against a 4/30/17 baseline (I just hard coded that baseline).

Recently I expanded that model to take each individual stock in any portfolio and make a consolidated view that included 1) sector information 2) US vs. Foreign 3) Yield 4) description of stock and reason for buying.  Now I can update that table in one place and re-do each of the portfolios 1-8 so that these fields are updated and consistent across each portfolio (I still have to do that, but I will in the relatively near future).  Here is a link to the data in PDF form.

 Portfolio 5/15/17 4/30/17 Change $ Change %
Portfolio One $42,377.71 $41,514.50 $863.21 2.08%
Portfolio Two $33,665.44 $33,334.33 $331.11 0.99%
Portfolio Three $17,972.62 $17,761.07 $211.55 1.19%
Portfolio Four $14,677.84 $14,625.89 $51.95 0.36%
Portfolio Five $14,479.56 $14,582.35 -$102.79 -0.70%
Portfolio Six $7,823.01 $7,834.26 -$11.25 -0.14%
Portfolio Seven $3,941.67 $3,879.91 $61.76 1.59%
Portfolio Eight $3,233.08 $3,258.89 -$25.81 -0.79%
Total $138,170.93 $136,791.20 $1,379.73 1.01%

Continue reading “New Google Sheets Analytics – Sector, US / Foreign, and Dividend Views”

Using Google Sheets for your Portfolio

These directions are specific to the portfolios that are being shared.  I likely will build a “public” version and link to it if someone else wants to leverage it.

The Google Sheets application is easily installed on your ipad or iphone.  From there you should just click on it and select your portfolio.

Alternatively, you could open it up on the web by going into Google and signing in and then bringing up the “sheets” application from Google Docs.

When you open the spreadsheet, there is a disclaimer that the financial data is updated 20 minutes late.  You can click on the “x” on the bottom to make this disclaimer go away.

Every time you open the application it will attempt to go out to the web and update all of the stock prices.  The prices are in several places (including the “text” under the current price on sold items) so it may take a little bit of time on portfolios with lots of stocks.

The tab that tells the story and history of all the stocks, the cash, investment to date, dividends, and sales is the “summary” tab.  This is the tab to look at if you want to see and study the entire picture.

Note that for any application, if you open it up on your phone or your ipad, you can resize the screen and it automatically zooms in or out.  This is a great feature and recommended.  If you look at it on your PC or Mac you need to zoom in or out by using the zoom function or + / – depending on how your machine is set up.  Or you can just use your mouse or arrow tab to get around.

Day to day, I recommend looking at the “analytics” tab.  There are multiple tabs in the sheet and it may or may not open up to that tab first.  You can just click on the tab at the bottom for that one to come up.

The analytics tab has all of your stocks.  You can see how the portfolio has changed that day.  Increases are automatically in green and decreases are in red.  The increases and decreases are in percentage term and in dollar terms (your net gain or loss for the day).  At the bottom of the analytics column you can see the total change across all of your stocks for the day.

In the box below the green / red section of your stocks on the analytics tab, there are 3 other benchmarks.  The first one is the S&P 500 index.  The second benchmark is for the non US stocks (unhedged, so it contains both stock price performance and the impact of currency changes).  The third benchmark is the US dollar vs a basket of foreign currencies, which shows the direction of whether the US dollar is going up or down.  Generally, if the US dollar goes up, there is a decrease in the value of your foreign stocks.

To the left on the analytics sheet, there are 4 items in a different box.  They start with the % of your stocks that are US vs. foreign, the % of your portfolio that is tied to the largest sector, the % of your portfolio that is in high dividend stocks (about 3% or more in dividend yield) and the % of your total portfolio that is in cash (not invested in stocks).

You can also see the 52 week high and low and the % of 52 week high that the stock is currently at. 100% would be the highest value and stocks in the 90% means that they are near or testing a 52 week high.