[HN Gopher] Spreadsheet formulas for personal finance
       ___________________________________________________________________
        
       Spreadsheet formulas for personal finance
        
       Author : bouk
       Score  : 332 points
       Date   : 2021-08-02 14:57 UTC (2 days ago)
        
 (HTM) web link (bou.ke)
 (TXT) w3m dump (bou.ke)
        
       | [deleted]
        
       | marianov wrote:
       | High inflation question:
       | 
       | Given 40% inflation. An item is offered for $1200 in 12 "zero
       | interest" payments of $100 or $800 in cash.
       | 
       | How do you compare their real cost taking into account inflation?
        
         | narush wrote:
         | Are they monthly payments?
        
         | CaptainNegative wrote:
         | If (annual) inflation is 40%, then the annual discount factor
         | is 1.40 and the monthly one is c = 1.40^(1/12) [?] 1.0284.
         | 
         | Assuming the $100 payments are paid at the end of each month,
         | the value of the money sent over in today's dollars is
         | $((100/c^1) + (100/c^2) + (100/c^3) + ... + (100/c^12)) which
         | is a geometric series with ratio 1/c, so the sum is (100/c^1 -
         | 100/c^(12+1))/(1-1/c) [?] $1005.
         | 
         | So take the cash offer.
         | 
         | For spreadsheet calculations, look into the SERIESSUM flavor of
         | macros.
        
           | medvezhenok wrote:
           | That's computing based on purely the discounted value of
           | money. The more useful metric is not the % of inflation, but
           | rather the % you can get on your money lying around (your
           | answer assumes that to be 40% annually as well - i.e. a real
           | rate of zero, but real rates on all of your options could be
           | deeply negative as well).
           | 
           | (though from an academic point of view you are completely
           | correct)
        
       | yboris wrote:
       | Slightly-related CLI I created:
       | https://github.com/whyboris/mortgage-and-investments
       | 
       | Helped me compare different approaches to balancing paying off
       | the mortgage vs investing.
        
       | scubakid wrote:
       | Wow this is like a flashback to my own experiments in Excel,
       | prior to going full mad-scientist for the past 6 months and
       | creating a web app for FI/FIRE planning called ProjectiFi:
       | 
       | https://projectifi.io/
       | 
       | I had been using similar functions in parts of my spreadsheet,
       | but as I kept adding more and more nuance and flexibility to the
       | life planning and projection aspects, eventually the formulas
       | just reached such a critical mass that the whole spreadsheet got
       | really painful to maintain. If you feel like kicking the tires on
       | ProjectiFi, I'd be curious to hear your thoughts -- I've been
       | working hard to make everything that had become unwieldy and
       | difficult in Excel for FI planning and experimentation feel more
       | intuitive and straightforward.
        
         | enchiridion wrote:
         | Cool site! If you'd like a bit constructive feedback, the
         | autofolding menus were a bit slow to open and anxiety inducing.
        
           | scubakid wrote:
           | Do you mean the animation should be faster when you open a
           | new one? If so, good to know -- that'll be a simple tweak.
           | I'm sure I should put more effort into the landing page
           | overall... the reality is that so far I've spent nearly all
           | my time trying to make the core app robust but intuitive.
        
       | imsd wrote:
       | Interesting formulas to take my spreadsheets up a level.
       | 
       | For anyone interested, I made a Google Sheets template that I
       | share with my friends. It has been well-received.
       | 
       | The crypto section can be ignored for those not involved with
       | that sector.
       | 
       | If it's useful, would love to hear your feedback.
       | 
       | https://docs.google.com/spreadsheets/d/1qYLOAjzaIIcFLFw_j-P4...
       | 
       | Of course, much can be automated using Google Finance and
       | relevant pricing APIs to auto-update position values.
        
         | xorfish wrote:
         | Here is my sheet that is mainly used for rebalancing ETFs
         | according to some simple rules. It is currency agnostic (base
         | currency can be changed) and should work fine for European
         | investors as well.
         | 
         | It automatically pulls MSCI market cap information and
         | determines the allocation based on that.
         | 
         | Then the number of shares that you need to buy or sell is
         | calculated based on the target allocation.
         | 
         | If you use Interactive Brokers, then buy and sell texts for the
         | IBOT are also generated.
         | 
         | https://docs.google.com/spreadsheets/d/1yJSF7tBZpJPvRf7tja-7...
        
         | settrans wrote:
         | This looks great; it nearly identical to a sheet I developed
         | for my personal use.
         | 
         | The biggest improvement I'd like to make to mine is to
         | implement some approximated form of risk parity[0]. That is,
         | instead of comparing nominal allocations, to compare weighted
         | risk allocations by asset class. This is useful because (for
         | example) equities will contribute significantly more volatility
         | to your portfolio than, say, fixed income, so to the extent you
         | are trying to capture the diversification benefits of
         | allocating across different risk buckets, you may want to scale
         | your exposure according to volatility[1].
         | 
         | There is a modeling challenge here, of course, because asset
         | classes will never be independent risks, but I'd prefer
         | something directionally indicative rather than econometrically
         | optimal.
         | 
         | [0] https://en.wikipedia.org/wiki/Risk_parity [1]
         | https://www.ipe.com/risk-parity-the-truly-balanced-portfolio...
        
           | xorfish wrote:
           | I would caution against using risk parity as it assumes that
           | you know the volatility and correlation of different asset
           | classes.
           | 
           | Look at the Figure 1 of this paper:
           | 
           | https://www.casact.org/sites/default/files/old/01pcas_scheel.
           | ..
        
           | imsd wrote:
           | That'd be a great addition. I plan to update this with
           | historical charting and tracking of position values over
           | time. I'll see if I can find a way to add risk parity. Makes
           | a lot of sense.
        
         | theNJR wrote:
         | Thank you!
        
       | captainill wrote:
       | Does anyone have a good resource for learning to write beginner
       | through advanced formulas?
        
         | gerbler wrote:
         | You can look at a few of the sheets people link to here and
         | just fiddle around with changing things too to see what happens
        
         | conductr wrote:
         | Not to be snarky but, Just start. Pretty much every excel user
         | is self taught. You can google for the name of the formula that
         | is helpful for your use just like you would programming.
         | 
         | Most of what separates a power user from an average joe is
         | having an approach to the problem and laying the foundation in
         | a way to be a "model".
         | 
         | I'm seen as a power user even within my peer group of finance
         | folks. I just have a way of laying things out and breaking up
         | the problem from data/inputs to print ready outputs. I'm not
         | usually doing anything fancy like using obscure formulas. But
         | when I do, I like these;
         | 
         | * Use -- to convert Boolean to integer * Use index/match
         | instead of vlookup (you can more easily insert/delete columns
         | without breaking) * make yourself a style guide (so you know
         | what a color means; hard value, input, etc) * avoid volatile
         | functions. Learn what functions are volatile * get good at
         | auditing formulas/debugging. It's really just takes experience
        
         | emmelaich wrote:
         | Not quite what you want but try this anyway. "You suck at
         | Excel" by Joel Spolsky
         | 
         | https://www.youtube.com/watch?v=0nbkaYsR94c
        
       | nybble41 wrote:
       | This is a nice article, but it ignores the difference between
       | nominal and effective interest rates. Simple division only works
       | on nominal interest rates, but you are more likely to encounter
       | effective rates which need to be converted first.
       | 
       | > If I have EUR1000 in an investment that grows with 5% annually
       | and I contribute EUR100 per month for the next 10 years, how much
       | will accrue? ... This can be calculated with the following
       | formula: ... FV(5% / 12, 10 x 12, 100, 1000) = -17,175.24
       | 
       | If your investment grows 5% annually then this is the effective
       | rate, not the nominal rate. The monthly interest rate is thus not
       | 5%/12 but rather ((1+5%)^(1/12))-1, due to compounding--this can
       | also be written NOMINAL(rate, nper)/nper. You can see the
       | difference if you compare results with different numbers of
       | periods but no contributions--the result should be the same no
       | matter how the time is divided up.                 # Basic
       | formula, 5% annual growth for 10 years with 1-year period
       | FV(5%, 10, 0, -1000, 0) = $1,628.89            # As per article,
       | 5% annually for 10 years but with monthly periods       FV(5%/12,
       | 10*12, 0, -1000, 0) = $1,647.01            # Converting to the
       | nominal rate before division gives consistent results
       | FV(NOMINAL(5%, 12)/12, 10*12, 0, -1000, 0) = $1,628.89
        
       | asadawadia wrote:
       | For the developers, there is a really nice go library with these
       | formulae https://github.com/alpeb/go-finance
       | 
       | A guide is here: https://blog.aawadia.dev/2020/12/01/finance-
       | concepts-go-fina...
        
       | jplr8922 wrote:
       | I have an MSC in quant finance, and i'm seriously considering
       | learning Django (in top of my backend skills) to build an
       | complete app for personal finance management.
       | 
       | Key features ; - Budget (aka cashflow management, what am I doing
       | with my paycheck next month?) - Project planning (aka balance
       | sheet, what is the purpose of my inflows and outflows over time?)
       | - End of year results(aka do my projected budget match my
       | projects, and if you want to travel so much why are you spending
       | X amount on alchool?) - Taxes (how do I pay less of them) -
       | Insurance (how do I mitigate common risks, and when should I
       | purchase insurance to protect my projects)
       | 
       | I myself need one app for financial transaction, another for
       | rebalancing my portfolio of ETF, one for doing my taxes, a
       | spreadsheet for my budget, etc. My bank credit card and debit
       | card are managed by two different units which refuse to talk to
       | each other and share information. This is ridiculous.
        
         | scrollaway wrote:
         | Send me an email if you're looking for work :)
        
         | 9erdelta wrote:
         | There is a dire need for a good personal finance app. Mint is
         | just out there to grab data, YNAB is ok but super limited. And
         | then pretty much every bank site is lacking in any meaningful
         | tools and API access.
        
         | edem wrote:
         | I want to do the same, but I don't have the math knowledge. I
         | have the programming knowledge though. Do you want to
         | collaborate? Feel free to send a DM if you do.
        
         | kachnuv_ocasek wrote:
         | Why do you want to pay less taxes?
        
           | [deleted]
        
           | the_fire_friar wrote:
           | I'd guess to keep more money to use for things that are
           | important to them.
           | 
           | Do people actively look for ways to pay _more_ taxes?
        
           | madamelic wrote:
           | It isn't illegal or even immoral to reduce your taxes to as
           | low as you can legally. You shouldn't pay more taxes than you
           | need to even if you believe in socialism.
           | 
           | If you are American and not reporting the right number of
           | allowances on your W-4, you are giving the gov't a free loan.
        
           | Alupis wrote:
           | It is not somehow patriotic to pay more taxes than one
           | legally owes.
           | 
           | Overpaying taxes (what a lot of people unintentionally do
           | that don't have resources to navigate every nook and cranny
           | of the labyrinthian tax code) accomplishes nothing but make
           | the individual more poor than they already were. Minimizing
           | overpayment is the best possible thing an individual can do.
        
           | jplr8922 wrote:
           | Its not that I want to completely avoid them. Its that tax
           | laws of many countries are poorly written (or applied) and
           | not doing optimization is financial suicide.
           | 
           | Consider tax sheltered accounts (TFSA-RRSP in Canada, 401k in
           | the US). Many people do not understand how they work or even
           | what they are ; a lot of stranger tell me they ''purchased
           | RRSP at their bank last month''.
           | 
           | Also consider the case of freelance consultant. If you are
           | your own business, you must understand what is tax
           | deductible, and what is not.
           | 
           | Finally, different countries have different fiscal law
           | regarding property. A lot of people in Canada invest in real
           | estate because they do not have an easy access to financial
           | markets. Here, capital gains of non primary residence is not
           | tax deductible... oops.
           | 
           | You get the point. The is not financial planning without tax
           | planning. From a dev point of view, consider the fiscal laws
           | of a country like COBOL legacy code. Do not assume it will
           | work as intended.
        
             | ZeroGravitas wrote:
             | I'm generally pro tax if that's a thing, but it is worth
             | noting that many countries use tax policy to shape
             | incentives. If everyone ignored that incentive structure
             | and just paid the tax, then there'd be more cigarette
             | smokers and less EV drivers.
             | 
             | So you could in many ways reframe "avoiding taxes" as
             | "doing what the government tells you to do".
        
           | [deleted]
        
           | B4CKlash wrote:
           | Paying less in taxes doesn't have to be nefarious.
           | 
           | When you put money into a 401K you're shielding income from
           | taxation. A 401K is an explicit tradeoff the government has
           | created; individuals saving more today will hopefully
           | translate into less reliance on the safety net in the future.
        
       | the_fire_friar wrote:
       | Love these formulas and wish this information was more understood
       | and accessible to people when making decisions. I've personally
       | benefited a lot from a mortgage payoff spreadsheet I have. It's
       | so easy to duplicate a tab, change the interest rate or
       | additional payments and see what the long term impact is.
       | 
       | That being said, and a disclaimer that I created this, I have
       | been charting my path to being able to retire early. I found it
       | difficult when duplicating tabs to simulate different scenarios
       | and keeping the tabs up-to-date with formula changes. If this
       | speaks to any of you, then consider checking out the tool I made
       | - I have not looked back at my old spreadsheets.
       | 
       | Sample forecast: https://fiers.co/forecast/6020f254b4e8c
       | 
       | Forecast comparison:
       | https://fiers.co/forecasts/compare/6020f254b4e8c/60488472528...
        
         | phonon wrote:
         | Have you looked at the "What-if Analysis" functionality in
         | Excel? Scenario Manager and Data Table is designed for that
         | kind of use case (one set of formulas, multiple sets of
         | inputs/scenarios.)
         | 
         | Here are some videos on how to use them.
         | 
         | Data Table https://www.youtube.com/watch?v=y7S9ecg1wdQ
         | 
         | Scenario Manager https://www.youtube.com/watch?v=b_eFIdsV1Bk
        
           | the_fire_friar wrote:
           | Those are really cool. I didn't know about them (I was also
           | using Google Sheets :|).
           | 
           | Perhaps because I'm comfortable writing software it still
           | feels very limiting to work within spreadsheets.
        
       | [deleted]
        
       | divbzero wrote:
       | > _An controversial book on investing I recently read is
       | Lifecycle Investing which argues that young people are often much
       | too conservative in their investment strategy, because they
       | should model their future earnings as a bond and allocate enough
       | to equities to compensate for holding this bond, even leveraging
       | up to 100% to get the right allocation._
       | 
       | That's a pretty interesting idea. I wouldn't take the _future
       | earnings = bond_ concept literally, especially if you're in a
       | high volatility profession, but it seems useful as a mental check
       | when assessing asset allocations.
        
         | qixv wrote:
         | This is not controversial, at least not in Denmark. All big
         | pension providers invests your money in this way (unless you
         | explicitly drop out).
         | 
         | I'm an actuary and reasearcher, and the theory is well
         | explained in the academic literature. And you are of course
         | right with respect to the volatility of your future earnings.
        
           | thebean11 wrote:
           | If you were guaranteed some perpetual income if you were
           | unable to work for any reason (including getting fired and
           | just not being able to find a job) I think it'd be a great
           | model. In the US I think the model is too risky given the
           | huge salaries and our collective precarity.
        
             | tkojames wrote:
             | Depends though. For example if you are say 30. Own a house
             | with decent mortgage cheaper than rent. If you have let's
             | say more invested than your total debt including mortgage
             | not counting hopefully equity in the house. Plus 2-4 years
             | invested in taxable account. Why not go 100 stock in
             | retirement accounts.
             | 
             | Working in tech you can bank alot of money quickly. If you
             | keep your lifestyle low. Then if something happens and
             | everything blows up. If you have enough saved you can get
             | by. Plus alot benefits in the united states are based on
             | income not assets.
             | 
             | I have thought a lot about this. I have been extremely
             | lucky to fall into a decent tech job that is way better
             | than working for my local university a few years ago.
             | 
             | Our current spending for a year with so and I is around 60k
             | a year.
             | 
             | The 4 percent rule says that is about 1.5 million or so.
             | Not there yet plus I like working so far.
             | 
             | But if I have say 500k saved and something happens. I can
             | withdraw around 20k a year. But if let's both of us got
             | minimum wage jobs. So 30 an hour total we can cover that
             | gap.
        
         | drited wrote:
         | How long would you expect someone in a high volatility
         | profession to be out of work for? The logic would really only
         | be flawed if someone became long term unemployed or didn't have
         | enough cash reserve to cover a few months of temporary
         | unemployment and hence was risking selling equities from
         | savings at a time of unemployment (which could well correlate
         | with low equity valuations)
        
       | basseq wrote:
       | I like XIRR to get an _actual_ sense of what my annualized
       | portfolio performance looks like.
       | 
       | Pretty much every bank, brokerage, or financial software I've
       | used is "dumb" and will a) count deposits as growth _, b) show
       | total lifetime growth, and /or c) ignore deposits.
       | 
       | XIRR allows me to better benchmark portfolio performance by
       | accounting for when I deposit (or withdraw) money so I can
       | clearly say, "I'm earning X% per year."
       | 
       | _ Schwab is terrible at this. "You gained 5% today!" No, I
       | didn't, I deposited $1,000 into my brokerage account.
        
         | dv_dt wrote:
         | Also annoying, most stock trackers in brokerages and elsewhere
         | really don't track dividend payments as performance either.
        
         | JALTU wrote:
         | Personal finance is simple, financial planning
         | (forecasting/scenario planning) is hard, and building software
         | to "teach" this to customers is vastly harder and not really in
         | the wheelhouse of financial institutions. This isn't to defend
         | such companies, nor to knock developers, just to point out that
         | it's very difficult to meet people where they are on this very
         | personal topic.
         | 
         | Then again, the Ux of Fidelity's site, for example, is also a
         | great example of how not to do things, IMO.
        
         | repiret wrote:
         | FWIW, my brokerage (Raymond James) does this right.
        
         | kccqzy wrote:
         | HealthEquity, where I keep my HSA account, manages to get this
         | right. They use modified Dietz return which is easier to
         | calculate than the IRR but remarkably similar.
         | 
         | I calculate the modified Dietz return for my other accounts
         | too. It's easy enough that unlike IRR you don't need the
         | function to be built in to the spreadsheet software to
         | calculate it.
        
           | basseq wrote:
           | This is great! Thanks for the info.
        
       | mattbillenstein wrote:
       | Re FIRE, I built this model some time ago:
       | https://docs.google.com/spreadsheets/d/1E6TjJyowYowexkSvNV8t...
       | 
       | Sorta more or less models and validates the 4% rule.
       | 
       | And I have another sheet to track all my investments, etc using
       | the GOOGLEFINANCE function to update with the market.
       | 
       | I've also looked at using something like Plaid to import
       | banking/credit card data, but it was all too complicated. So I
       | now get a daily balance update via email that I scrape into my
       | sheet using a Python script... Keeps me from needing to manually
       | update the balances myself.
        
       | senthil_rajasek wrote:
       | While this spreadsheet and formulas are useful I found taking an
       | Intro to Finance course to be more useful. Especially, because I
       | have a purely engineering background
       | 
       | I've been recommending this course to my family and friends,
       | https://www.coursera.org/learn/time-value-of-money
        
       | isthis129283 wrote:
       | I love mid.
       | 
       | Sometimes you don't want the first few characters, or the last
       | few, you just really want the ones in the middle.
        
       | vlucas wrote:
       | Hey - creator of BudgetSheet here (https://www.budgetsheet.net/
       | ).
       | 
       | These formulas are great! I am currently working on adding more
       | charts, graphs, and formulas to my product. These formulas and
       | handy to know about for a net worth sheet. Thanks for sharing!
        
         | kraig wrote:
         | I use Tiller for this. By initial comparison this looks more
         | expensive with less features and a limit on total accounts, am
         | I missing something? Tiller is a bit weak on tracking stocks in
         | investment accounts.
        
       | usrme wrote:
       | These are awesome and exactly the kind of formulas I wish I would
       | have been taught earlier on my life! I've personally been using a
       | free spreadsheet-based tool called the Investment Portfolio
       | Tracker by The Measure of a Plan
       | (https://themeasureofaplan.com/investment-portfolio-tracker/) and
       | it's been absolutely wonderful; it never ceases to amaze me how
       | much power spreadsheets have. The author has other tools as well
       | (https://themeasureofaplan.com/tools/) and is really responsive
       | via email. Be sure to donate if you find value in his work as I
       | did!
        
         | wintermutestwin wrote:
         | This looks so awesome, but there is no way that I am putting
         | this kind of personal data into the cloud (and am particularly
         | not wanting to feed Google's stalker AI).
         | 
         | From the FAQ, when asked if there was an Excel version:
         | 
         | -------------------
         | 
         | Unfortunately not.
         | 
         | For those keeping score at home, you'll know that I have a
         | preference for excel over Google Sheets. However, I haven't
         | been able to find a reliable way of getting current and
         | historical stock/ETF price data to import automatically into
         | excel.
         | 
         | While Office 365 has a new "Stocks" feature that lets you
         | import real-time stock prices into excel, this unfortunately
         | doesn't work for historical prices (yesterday, last month, last
         | year's price, etc).
         | 
         | This spreadsheet uses historical pricing info to calculate
         | portfolio performance between any two dates, so historical
         | prices are a critical input.
         | 
         | -------------------
         | 
         | I'm finding it hard to believe that finance professionals don't
         | have some kind of programmatic access to "current and
         | historical stock/ETF price data." Does anyone know? I'd be
         | willing to pay a reasonable "individual investor" level fee.
        
           | ptrklly wrote:
           | I think CapIQ is most common, but don't think they do
           | individual subscriptions.
        
           | drited wrote:
           | The Datastream excel plugin from Refinitiv is one paid option
           | used by professionals.
           | 
           | Or if it is just for personal use you could probably scrape
           | yahoo's historical data tables (check their terms of use etc
           | first of course)
        
       | Bostonian wrote:
       | Is there a Python package people recommend that has code for
       | these kinds of calculations?
        
         | bouk wrote:
         | numpy-financial does: https://github.com/numpy/numpy-
         | financial/blob/master/numpy_f...
        
       | asdff wrote:
       | I wish it was easier to actually pull information from various
       | banks and accounts. For all of mine, I have to log in to the
       | website and click around some 2006 era website to set a range or
       | dates or something before I can generate a CSV file. It's a ton
       | of friction just to get a look at my financials. I wish I could
       | always have access to updated CSV files without having to spend
       | all this time for each and every account. The only alternative is
       | paid services like mint, which I don't want. I just want my raw
       | data so I can roll my own and come up with my own ways to manage
       | my finances.
        
         | shepherdjerred wrote:
         | Excel[0] has this functionality built in via Plaid[1]. There
         | are other solutions like YNAB[2] or Wealthfront[3]. I agree
         | with you though. I have a nice python program for understanding
         | my finances, but I still have to manually update bank/credit
         | card/loan balances.
         | 
         | [0] https://plaid.com/blog/microsoft-announcement/
         | 
         | [1] https://plaid.com/
         | 
         | [2] https://www.youneedabudget.com/
         | 
         | [3] https://www.wealthfront.com/
        
         | jonshariat wrote:
         | You can do this with Tiller (https://www.tillerhq.com/), it
         | pulls it down for you.
         | 
         | Also when trying to remember the tiller app, I found that Excel
         | now has this as part of office 365
         | https://www.theverge.com/2020/6/16/21292642/microsoft-money-...
        
           | et1337 wrote:
           | Tiller user here. It's a brilliant product. They have many
           | different templates that allow you to manage money at the
           | level of detail you want. I tried a ton of different apps and
           | none of them were flexible enough.
           | 
           | My only complaint is that their Google Sheets sidebar UI can
           | be abysmally slow at times, and you have to open it and hit
           | "sync" to load transactions from your financial institutions.
        
       | narush wrote:
       | Very cool! I really appreciate this list. I'm currently
       | evaluating what spreadsheet functions to add to my spreadsheet
       | product [1], and I'm gonna add these to the roadmap.
       | 
       | We currently support the functions listed here [2] - and allow
       | you to write spreadsheet formulas that get transpiled directly to
       | Python code!
       | 
       | If y'all have any other reccomendations for functions we should
       | add - let me know!
       | 
       | [1] https://trymito.io/hn [2] https://docs.trymito.io/how-
       | to/interacting-with-your-data/mi...
        
       | jldugger wrote:
       | Okay, now do one for taxes: given a taxable income, and a table
       | representing the tax brackets, calculate the taxes owed in a
       | single formula.
        
         | whateveracct wrote:
         | Not in spreadsheets, but there's fun to be had here in Haskell-
         | land:
         | https://hackage.haskell.org/package/tax-0.2.0.0/docs/Data-Ta...
         | 
         | I still use a spreadsheet, but I'm always tempted to manage my
         | financial planning with Haskell and org-mode heh
        
         | NamTaf wrote:
         | Some form of the golden duo of INDEX and MATCH should do it in
         | Excel.
         | 
         | I suspect you could do it with SUMPRODUCT too if the tax table
         | contains sufficient data (e.g. for each band a lump-sum +
         | progressive rate may be necessary) but it may still be an array
         | equation (ctrl-shift-enter when entered, with curly braces
         | displayed around it). I'm not in front of a PC so I can't try
         | to confirm.
        
         | bouk wrote:
         | I think you could probably do this in a single formula with
         | SUMPRODUCT, but right now I just have a table that uses MIN(0,
         | X) and MAX(0, Y) tricks to calculate it.
        
           | jldugger wrote:
           | AFAICT, SUMPRODUCT is insufficient, you need to provide
           | different numbers to each row. I need a fold_left version of
           | sumproduct.
        
         | basseq wrote:
         | Because I like a challenge:                 =SUMPRODUCT(
         | (bracket_min<income)*         (
         | ((income<=bracket_max)*(income-bracket_min))           +
         | ((income>bracket_max)*(bracket_max-bracket_min))         )
         | *bracket_rate       )
         | 
         | Where income is your income, bracket_min is the range of
         | bracket minimums, bracket_max is the range of bracket maximums,
         | and bracket_rate is the range of bracket tax rates.
         | 
         | Demo on Google Sheets:
         | 
         | https://docs.google.com/spreadsheets/d/1z0vx8TJeWr-hbJ3q6E7r...
        
           | onlyrealcuzzo wrote:
           | The biggest problem with this is trying to model tax payments
           | in the future.
           | 
           | In ten years, you have no idea what tax rates will be. But
           | you can be pretty confident the Fed will have devalued money
           | by 30%+.
           | 
           | Even if you just want to have tax brackets adjust to
           | inflation - this function gets to be really complicated.
        
           | bouk wrote:
           | Really cool! Unfortunately Numbers doesn't support more
           | complicated SUMPRODUCT formulas...
        
             | basseq wrote:
             | You could do it with a bunch of INDEX-MATCH formulas and
             | pre-calculating base tax per bracket:
             | =(income-INDEX(bracket_min,match(income,bracket_min,1)))*
             | INDEX(bracket_tax,match(income,bracket_min,1))+
             | INDEX(bracket_base_tax,match(income,bracket_min,1))
        
       ___________________________________________________________________
       (page generated 2021-08-04 23:00 UTC)