Divide

Divides the first value by the values that follow and merges the result. Use it for averages, per-unit prices, or splitting a total.

Syntax

{{divide value1 value2 ... precision=n culture="xx-XX"}}

Parameters

Name Type Required Description
Values Number Required The value to divide, followed by the value or values to divide it by.
precision Number Optional Number of digits after the decimal point. If you leave it off, the result is rounded to 6 decimal places, because a division like 10 divided by 3 would otherwise run to dozens of digits.
culture Text Optional The culture used to format the result. Defaults to your account's culture.
Note: Dividing by zero merges 0 rather than causing an error, and an empty or non-numeric value counts as zero. If the value you are dividing by might be empty, such as an order count for a brand new customer, consider wrapping the line in {{#ifNotBlank}} so you do not show a meaningless 0.

Examples

The examples below are based on the following sample content:

Average order value: {{divide Contact.totalSpend Contact.orderCount precision=2}}

A. Total spend is 10, order count is 3

Average order value: 3.33

B. Order count is empty or 0

Average order value: 0

C. Without a precision, using {{divide Contact.totalSpend Contact.orderCount}}

Average order value: 3.333333

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us