substitute_formula_vars function

Replace variables in formula with sum of other variables