Welcome back to part two of how PowerShell can help track your 401k growth. In my last post we figured out how much Bob Boberson is going to have in a retirement account at the age of 65. We completely missed whether or not that will be enough, or if it was overshooting and Bob could have called it quits four years earlier. That sounds horrible! Now, let’s take a look at finding out what YOUR retirement number is, along with a rough estimate of when you will hit that point.
As stated in my last post I am still not a financial advisor so feel free to use this for your own information, but none of this comes with any kind of guarantee. This tool will give you a good idea to determine if you are on the correct path toward your retirement. If you disagree with some of my math I would love to hear it. I want this to be as accurate as we can get it.
There are a lot of thoughts about how to approach retirement. One of the most common, is stating a large number that you would need and hoping you get there without tracking the trend. Another method that has gained a lot of popularity recently is Financial Independence Retire Early (FIRE). This is all about minimizing costs, thereby lowering what you need to retire. A popular blog on living this lifestyle is Mr. Money Mustache. I read his stuff, and I use a lot of his ideas in my own planning. A major difference is I lack his discipline on what I am willing to cut back. I love the idea of retiring early, and I plan on it. I’m unwilling to cut back on my lifestyle to achieve it though. I respect his approach a lot, but I like eating out and I plan to continue it at the same rate in retirement. You might say that I agree with FIRE, but I want a little hedonism on the side (ok a lot of hedonism).
Luckily for me the math for my retirement plans are no different than the math for FIRE. The numbers are just larger. The quick version only multiplies your total expenses by 25, and that is your number. This is usually called the 4% rule. You will find a lot of people don’t agree with it, but the counterpoint to the dissenters was already written far better than I could, so I didn’t touch it. If you want more education on the 4% rule, check it out here. If you lack interest in that, just know I agree with it and my writing going forward assumes it is correct.
This takes me to a point that led to me creating my own 401k calculator. There is a common belief that says in retirement your annual expenses will be a large percentage of what your final income is. I lack the eloquence to explain how much I hate that idea. In fact, you can’t see it because it is digital, but this is the seventh version of the sentence on my dislike of the idea. I have to keep rewriting it, because every version contains very angry language that editors will not approve. Sure, I stated earlier that I budget too high to be a true FIRE advocate, but my budget is based on the lifestyle I want. The wife and I determined our budget early on, and as our careers progressed it has stayed pretty similar.
Outside of lifestyle costs, my retirement is delayed because I have a far more conservative approach. Knowing what it costs me to live is nice, but how do we factor in large expenses? Purchasing cars, replacing roofing, and furnaces are good examples of high cost items that often come up between 10 to 20 years. If we divide the cost of these items by the life expectancy we get a good idea of what the average annual cost is. You can set that into its own account to grow and pay from it as the item comes due. This allows you to continue living within your budget, and not needing to adapt to the major expenses.
Let’s say seven years into your retirement you have a run of bad luck. You need to replace your roof, fridge, and furnace. Congrats, you have stumbled into $14,500 in unaccounted expenses. Thanks to some pre-planning, your account for these expenses has already gained $39,740. That doesn’t even consider what the balance may be if you invested that money. Thankfully, you can absorb that cost and have no impact on your living expenses.
I don’t want to look into all the day-to-day costs for Bob, but we will assume at the time of retirement he will have paid off his mortgage. After accounting for property taxes, groceries, travel, restaurants, medical, and miscellaneous costs, Bob needs $30,000 to maintain his life style. We will add $6,000 for the large expenses knowing that the grand total is 36k per year.
You might think that once you stand on the mountain top and scream “RETIREMENT!!!!!,” that the government would respect that choice and stop taxing you. They are pretty stubborn about getting that money, so to have the $36,000, Bob will need to withdraw around $38,000. If we are following the 4% rule Bob is going to need $950,000. Based on our previous numbers Bob has worked longer than he needs to when we guessed 65. It is worth noting that we’re assuming Bob never collects a penny from Social Security since adding it does complicate things quite a bit.
So far we’ve determined our retirement number, but we are really here to find out when we CAN retire. This will require modifying our 401k calculator script from the earlier blog.
First step is adding the fields to the winforms on the calculator. Most important thing, we remove the retirement age, and replace it with “Annual Retirement Spending” and “Planned Withdraw Rate.” With these changes instead of just going until number x, the calculator will continue to grow until you hit your number.
Sidenote: While I said I was running with the 4% rule, if you are opposed you can change the planned withdraw rate to 3% if you prefer.
I also added the drawdown phase, because knowing you can theoretically retire is nice, but seeing how your nestegg performs in retirement is so much nicer. For some added realism we added inflation to simulate what it will cost extra per year, as well as show the new interest rate post-retirement.
The second one shows how it is not uncommon to shift your investments to more stable bonds, rather than in stocks after retirement. You don’t have to do this, so if you expect the same growth after retirement just set it to the same number. It is also worth noting that 401k’s require minimum distribution, so you will be forced to pull out more than we are talking about here. There is nothing saying you can’t take the mandatory withdrawals over your budget and reinvest them. This does make the taxes far more complex than we show, but it gives a decent rough estimate.
With that, let’s rerun the calculator for Bob and see how he is doing.
Woohoo, that’s one year earlier than his random guess from the earlier blog. And it could get even better. If Bob cuts 10k from his retirement spending he will be able to retire at 59. Three years earlier sounds awesome to me. As you can see from the graph above, after 30 years the number is starting to trend down instead of up. This is due to inflation added to his annual spending outpacing the growth of his principal. At this rate Bob’s retirement will run out in 48 years. So, if he plans to live to be 112 years old he may need to work for another couple of years.
I hear the voices of thousands of nerds yelling in unison. “Who cares about retirement Jordan, talk about the PowerShell!” The good news is that the changes are surprisingly easy. The first change is discovering the retirement number. The math is annual expenses divided by the withdrawal rate. In PowerShell:
$RetirementNumber = $Results.RetirementExpense / $Results.WithdrawalRate
The second change is instead of a foreach loop we want to do a Do/While. None of the math changes. An abbreviated example below:
$Contributions = $EmployeeContributions + $CompanyContributions
$zRate = [math]::pow((1 + $Results.InterestRate / $Results.NumContributionsPerYear), ($Results.NumContributionsPerYear))
$Results.Principal = [math]::Round(([int]$Results.Principal * $zRate) + ($Contributions * ($zRate - 1) / $Results.InterestRate))
}While($Results.Principal -le $RetirementNumber)
That is really all the changes needed. The withdrawal is following the same logic from Part One, the major change is we are replacing:
+ ($Contributions * ($zRate - 1) / $Results.InterestRate)
-($RetirementExpense * ($zRate - 1) / $Results.InterestRate)
I think this version of the calculator is a lot more robust and works better for deciding when we could be retiring. Now, since I’ve done the math, I can officially put in my notice at work.
Kelly, I formally submit my 21 year and four month resignation notice. I hope that this gives you the time needed to train my replacement.
**For the 401K Calculator in GitHub click here**