What is the best way to calculate whether your real estate purchase was "worth it" in retrospect? Our apartment has just gone under contract, and the sale will probably close at the end of the month. I've read jlcollinsnh's post about how to calculate rent v. buy opportunity cost, but that seems to be focused on a fixed moment in time.
We owned our apartment for 7 years and 6 months. I have an amortization spreadsheet for our mortgage, so I can see how much I was paying in interest and principle for each month (the proportions of each obviously changed over time). Now that we're selling it, I know both the purchase and sale price. I can calculate with reasonable certainty how much we paid in HOA fees and property taxes each month (both of which steadily marched upward over time). I can also estimate how much comparable rent would have been (again, not static over time), and the hypothetical investment return, had we reliably put all savings into VTSAX.
I basically want to be able to say that buying cost us $X, and if we had rented instead (given the benefit of hindsight), we would have spent $Y. I suspect the answer won't be a quick and dirty formula; otherwise I would have found something easy by googling (most comparison calculators are also based on a fixed moment, to help people make the initial decision).
TL;DR: This sounds a job for a spreadsheet - does anybody have one they've created for this problem? What data should I include? Is month-by-month best, to get the most precise comparison?