This afternoon I helped someone debug a financial spreadsheet. One of the reasons spreadsheets can be so frustrating to work with is that assumptions are hard to see. You have to click on cells one at a time to find formulas, then decode cell coordinates into their meanings.

The root problem turned out to be an assumption that sounds reasonable. You’re making two changes, one to a numerator and one to a denominator. The total change equals the sum of the results of each change separately. Except that’s not so.

At this point, a mathematician would say “Of course you can’t split the effects like that. It’s nonlinear.” But it’s worth pursuing a little further. For one thing, it doesn’t help a general audience to just say “it’s nonlinear.” For another, it’s worth seeing when it is appropriate, at least approximately, to attribute the effects this way.

You start with a numerator and denominator, *N*/*D*, then change *N* to *N*+*n* and change *D* to *D*+*d*. The total change is then (*N*+*n*)/(*D*+*d*) – *N*/*D*.

The result from only the change in the numerator is *n*/*D*. The result from only the change in denominator is *N*/(*D*+*d*) – *N*/*D*.

The difference between the total change and the sum of the two partial changes is

–*nd*/*D*(*D*+*d*).

The assumption that you can take the total change and attribute it to each change separately is wrong in general. But it is correct if *n* or *d* is zero, and it is approximately correct with *nd* is small. This can make the bug harder to find. It could also be useful when *nd* is indeed small and you don’t need to be exact.

Also, if all the terms are positive, the discrepancy is negative, i.e. the total change is less than the sum of the partial changes. Said another way, allocating the change to each cause separately over-estimates the total change.

Hi John,

Long time reader and first time posting. Concerning clicking on cells one at a time to find formulas in spreadsheets – specific to Excel, at least, there’s a way to display them all at once, by pressing and the “~” (tilde) key simultaneously. This toggles all of the equations to display at once; another press toggles back to normal view.

I appreciate your the great work you do on this blog!

Andy: Thanks. I didn’t know that.

Looks like it didn’t come through the first time – it should read CTRL + “~”.