gwp_calculate
The gwp_calculate Merge Tag returns the result of a calculation formula and formats the number as specified.
Options
formula (required) | The arithmetic expression to be calculated. Use field merge tags, e.g., {Number:5}, within the formula. |
number_format (optional, default = ‘decimal_dot’) | Specifies the format of the number. You can use decimal_comma , decimal_dot , or currency . |
thousands_sep (optional, default = true) | Determines whether to include a thousands separator. Set to false to disable.This option will be ignored for the currency format. |
raw (optional, default = false) | Output the number in decimal dot notation without any formatting. When true the other formatting options will be ignored. |
decimals (optional) | Integer value to set the number of decimals to round to. |
round (optional) | Set rounding options: round (default), ceil or floor |
Examples
{gwp_calculate formula="({Number:5}+{Number2:7})*{Number3:6}"}
Returns the calculated result based on the provided formula using decimal point formatting.
{gwp_calculate formula="({Number:5}+{Number2:7})*{Number3:6}" number_format=decimal_comma thousands_sep=false}
Returns the calculated result with decimal comma formatting, but without thousands separator.
{gwp_calculate formula="({Number:5}+{Number2:7})*{Number3:6}" number_format=currency}
Returns the calculated result formatted as currency. The thousands separator will be included according to the Gravity Forms currency settings.
{gwp_calculate formula="({Number:5}+{Number2:7})*{Number3:6}" raw=true}
Returns the calculated result in decimal dot notation without any formatting.
Frequently Asked Questions
The gwp_calculate merge tag lets you perform math calculations using field values in your Gravity Forms. You can create a formula using merge tags from your form fields, and the result will be displayed wherever you use this merge tag.
You can also choose how the result looks by adjusting the format, rounding, and decimal settings.
Example:{gwp_calculate formula="({Number 1:3} + {Number 2:5}) * {Number 3:6}"}
You can reference any field by using its regular merge tag inside the formula=”…” part of gwp_calculate.
Example:{gwp_calculate formula="{Amount:4} + {Tax:8}"}
This will add the values entered in the Amount and Tax fields.
You can choose how the result should look by setting the number_format option:
-decimal_dot → Example: 1234.56
-decimal_comma → Example: 1.234,56
-currency → Example: $1,234.56 (based on your Gravity Forms currency settings)
Example:{gwp_calculate formula="{Price:4} * 1.2" number_format=currency}
You can fine-tune the result with:
-decimals=X → number of decimal places to show
-round=round → round normally (default)
-round=ceil → always round up
-round=floor → always round down
Example:{gwp_calculate formula="{Score:7} / 3" decimals=2 round=round}
This will round the result to 2 decimal places.
Yes! You can include as many fields as you like by using their merge tags inside the formula. You can also use parentheses to control the order of operations, just like in regular math.
Example:{gwp_calculate formula="({Field 1:1} + {Field 2:2}) * {Field 3:3}"}
Last updated: 18-07-2025