I am in need of a different formula for the same column cells depending on the values of another column.
I am trying to avoid writing a five-line formula concatenating all of them into one because of readability and maintainability. It's quite possible for the formulas to be added, deleted and updated in future.
here is a simplified example:
the formula I use for deductions
right now is:
=IF(E7 = "salary", D7 * 0.2, IF(E7 = "rent", D7 * 0.15, D7)
Ideally, I would like to somehow call a separate formula in this IF
statement instead of doing the calculations in place. The separate formulas, in this case, being D7 * 0.15
and D7 * 0.2
but in my case are more complicated.
I can code JavaScript and I've read how to create custom functions that could do that (in js) but think there would be a more spreadsheedian
way.
So, is there a way to call separate formulas inside a formula and if not what is the best practice for this kind of situations.