When would you keep simple to medium-complex personal calculations in a spread sheet (Excel etc) and when would you write a small program or script for it?

For example when you want to calculate what size of mortgage you can afford to buy a house. I could create a spreadsheet and have a nice tabular representation. On the other hand, if i would write a small script in a nice language (in my case Haskell), i'd have the security of a nice type system, preventing typos etc.

What are the pro/cons in your opinion?

  • 1
    I would think that checking your work would prevent typos, not making a script. – Jetti Jun 21 '11 at 13:46
  • 1
    Calculating the mortgage is hardly a medium complex calculation, and it can be easily done in Excel (or on a piece of paper for that matter). Anything else is overkill. – Rook Jun 21 '11 at 13:59
  • @Rook: Gathering the necessary data was by far the biggst task. I don't think that composing those few functions in Haskell would take significantly longer than dragging and dropping formulas in a spreadsheet (e.g. in Excel "sum()", in Haskell "sum"). Can you elaborate where you see the line to "overkill" and how you define "overkill"? – LennyProgrammers Jun 21 '11 at 14:13
  • @Lenny222 - No, I can't, or should I say - do not wish to. Besides, you already pretty much gave the reasons in your comment and original post. – Rook Jun 21 '11 at 14:21
  • I'd use one of the thousands of online calculators for this that already exist, and do something more fun with the time saved! – Steven A. Lowe Jun 21 '11 at 17:09

You really have to ask yourself "Am I going to re-use this enough to justify the cost (or time)?". Many times it's not worth the cost of a full app or in the broader sense a tool.

I know too many developers that get all caught up in building "tools" and never actually accomplish the task at hand, in your case calculating mortgage payments. I had a partner on a project that spent weeks developing a system to dynamically generate the database schema for a project we were doing. He was concerned we would keep changing it, but he spent probably 10x on a tool that we would have spend manually updating the schema (DDL).

  • This has happened to me sometimes. I once wrote a python library to do the tedious numerical calculations in physics homework. It took me longer than if I had just plugged the numbers into my calculator. – Zhehao Mao Jun 21 '11 at 17:37

It depends on what you plan to do. For a mortgage calculations for my personal use, I used a spreadsheet. It was very easy to copy/paste cells with formulas and compare different sets of data and calculated results. This solution worked well because I was the only one using the spreadsheet (so the "UI" (cell layout) was particular to what I wanted), it was very fast and easy to set up (just create a formula for the mortgage calculation based on a few cells), and it offered very good flexibility (having multiple calculations with different inputs and comparing them) - and it was all done in less than 15 minutes. Unlikely I could have ever coded something that good that fast on my own.

If I needed something more customized than a spreadsheet (such as a very specific workflow, UI controls not available in spreadsheets, lots of file reading/writing, anything that can't be easily done with a simple sequence of formulae), I would have started planning something else in code.


It depends on yourself, whether you know a programming language, etc.

Excel is my dad's favourite program. He's retired now, but he used to do almost anything with Excel. He even wrote a Sudoku solver in Excel... I'm a programmer myself, I don't use spreadsheet applications that much, so I'd be inclined to write a small program rather than doing it in a spreadsheet.

Calculating mortgages sounds like a thing that a spreadsheet would be perfectly suited to.


Both are acceptable tools that can both perform the task at hand, so in that sense it is a matter of personal preference which you prefer to use.

If you are anything like me, you don't have enough time to write a custom program for my own personal use to do something specific, so I would personally try to use Excel.

I can see both sides of the coin though, maybe your motivation to write a custom program is to learn new skills in Haskell or whatever the current fad is in computer languages today. I would see the learning exercise in this case as the real product of my efforts and the final application itself sort of as a bonus.

I wouldn't be so quick to knock on Excel either, certainly it is limited from a computer programming perspective but that is because it is purpose built and designed to be. I view Excel like a highly sophisticated calculator. I have worked with people who have taught me some AMAZING things that Excel is capable of, complex mathematical calculations, statistics, and deep analytical reporting that supplements data warehouse dumps perfectly. Experts at Excel can make a good living doing just that, so learning new skills in Excel can certainly benefit your career in some way shape or form.

Not the answer you're looking for? Browse other questions tagged or ask your own question.