Excel formulas are output with misplaced references.

 

The application may not support the template pattern. Create a formula field in Salesforce and set it as a merge field.