New version with getVarFormula