Handlebars subtract
Handlebars subtract: returns the difference of subtracting the second value from the first.
Next
Runtime verified
Differs from official docs
Test scripts included
Returns the difference of subtracting the second value from the first.
Syntax
{{subtract value1 value2}}
Returns number.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value1 |
number | Yes | The value to subtract from. |
value2 |
number | Yes | The value to subtract. |
Example
Tested in a Marketing Cloud Next email on 2026-11-22:
{{subtract 5 3}}renders2, as documented.{{subtract 1.5 2.25}}breaks the email preview (HTTP 500). The documented result is-0.75.
Show Next test script
Show calls that fail in Next (one email each)
Differs from official docs
- The reference says
subtracthandles decimals as well as whole numbers and rounds the difference to two decimal places. In Marketing Cloud Next (tested 2026-11-22):{{subtract 1.5 2.25}}let the email save and publish, but the preview then failed with HTTP 500 and no message instead of rendering-0.75. Whole numbers work:{{subtract 5 3}}rendered2. Details
Marketing Cloud Next
Differs from the documentation
Whole numbers work: {{subtract 5 3}} gives 2. {{subtract 1.5 2.25}} breaks the email preview (HTTP 500) instead of giving the documented -0.75. Tested 2026-11-22 by rendering in a Marketing Cloud Next email.
See also
- AMPscript
Subtract— the AMPscript equivalent - Official reference