# Numeric

## 1. NUMBER

Converts a string representing a number into a decimal number.

{% tabs %}
{% tab title="Usage" %}
`NUMBER(parameter)`&#x20;

Replace `parameter` with a string you need to convert to decimal.

{% hint style="warning" %}
If `parameter` contains non-digit symbols, the function will throw an exception.
{% endhint %}
{% endtab %}

{% tab title="Example" %}
`NUMBER({Opportunity.Unique_ID__c})` returns decimal value of *Unique\_ID* field, e.g if *Unique\_ID* = *'1234'* function will return **1234.0**.
{% endtab %}
{% endtabs %}

## 2. INTNUMBER

Converts a string representing a number into an integer.

{% tabs %}
{% tab title="Usage" %}
`INTNUMBER(parameter)`&#x20;

Replace `parameter` with a string you need to convert to integer.

{% hint style="warning" %}
If `parameter` contains non-digit symbols, the function will throw an exception.
{% endhint %}
{% endtab %}

{% tab title="Example" %}
I`NTNUMBER({Opportunity.Unique_Value__c})` returns integer value of *Unique\_Value* field, e.g for *Unique\_Value\_\_с* = *'1234.32'* it will return **1234**.
{% endtab %}
{% endtabs %}

## 3. SUM

Returns integer or decimal value representing a sum of numeric parameters.

{% tabs %}
{% tab title="Usage" %}
`SUM(list_of_values OR value1, value2, ...)`&#x20;

Replace `list_of_values` argument with the list of numeric values (or pass numeric values as `value1`, `value2'`, etc). arguments.&#x20;

{% hint style="info" %}
You can also pass combination of arrays and separate numeric arguments.
{% endhint %}
{% endtab %}

{% tab title="Example 1" %}
Let *March Amount* = **5.5**, *April Amount* = **10** and *May Amount* = **15**.&#x20;

`SUM({Stub__c.March_Amount__c}, {Stub__c.April_Amount__c}, {Stub__c.May_Amount__c})` will return **30.5**.
{% endtab %}

{% tab title="Example 2" %}
Let *String* field stores following value: **'8, 8, 10, 12'**.&#x20;

`SUM(SPLIT({Stub__c.String__c}, ','))` will return **48**.
{% endtab %}

{% tab title="Example 3" %}
Let *March Amount* = **5.5**, *April Amount* = **10**, *May Amount* = **15** and *String* = **'8, 8, 10, 12'**.

`SUM({Stub__c.March_Amount__c}, {Stub__c.April_Amount__c}, {Stub__c.May_Amount__c}, SPLIT({Stub__c.String__c}, ','))` will return **78.5** (30.5 + 48).
{% endtab %}
{% endtabs %}

## 4. SUB

Returns integer or decimal value representing result of sequential subtraction.

{% tabs %}
{% tab title="Usage" %}
`SUB(list_of_values OR value1, value2, ...)`&#x20;

Replace `list_of_values` argument with the list of numeric values (or pass numeric values as `value1`, `value2`, etc. arguments).&#x20;

{% hint style="info" %}
You can also pass combination of arrays and separate numeric arguments - they will be subtracted first and then results will be subtracted.
{% endhint %}
{% endtab %}

{% tab title="Example 1" %}
Let *March Amount* = **5**, *April Amount* = **10** and *May Amount* = **15**.

`SUB({Stub__c.March_Amount__c}, {Stub__c.April_Amount__c}, {Stub__c.May_Amount__c})`  will return **-20** (5 - 10 - 15).
{% endtab %}

{% tab title="Example 2" %}
Let *String* field stores following value: **'8, 8, 10, 12'**.&#x20;

`SUB(SPLIT({Stub__c.String__c}, ','))` will return **-22** (8 - 8 - 10 - 12).
{% endtab %}

{% tab title="Example 3" %}
Let *March Amount* = **5**, *April Amount* = **10,** *May Amount* = **15** and *String* = **'8, 8, 10, 12'**.

`SUM({Stub__c.March_Amount__c}, {Stub__c.April_Amount__c}, {Stub__c.May_Amount__c}, SPLIT({Stub__c.String__c}, ','))` will return **2** ( (5 - 10 - 15) - (8 - 8 - 10 - 12) ).
{% endtab %}
{% endtabs %}

## 5. MULT

Returns integer or decimal value representing result of multiplication.

{% tabs %}
{% tab title="Usage" %}
`MULT(list_of_values OR value1, value2, ...)`&#x20;

Replace `list_of_values` argument with the list of numeric values (or pass numeric values as `value1`, `value2`, etc. arguments).&#x20;

{% hint style="info" %}
You can also pass combination of arrays and separate numeric arguments.
{% endhint %}
{% endtab %}

{% tab title="Example 1" %}
Let *March Amount* = **5**, *April Amount* = **10** and *May Amount* = **15**.&#x20;

`MULT({Stub__c.March_Amount__c}, {Stub__c.April_Amount__c}, {Stub__c.May_Amount__c})` will return **750**.
{% endtab %}

{% tab title="Example 2" %}
Let *String* field stores following value: **'8, 8, 10, 12'**.&#x20;

`MULT(SPLIT({Stub__c.String__c}, ','))` will return **7680** (8 \* 8 \* 10 \* 12).
{% endtab %}

{% tab title="Example 3" %}
Let *March Amount* = **5**, *April Amount* = **10**, *May Amount* = **15** and *String* =: **'8, 8, 10, 12'**.&#x20;

`MULT({Stub__c.March_Amount__c}, {Stub__c.April_Amount__c}, {Stub__c.May_Amount__c}, SPLIT({Stub__c.String__c}, ','))` will return **5760000** (750 \* 7680).
{% endtab %}
{% endtabs %}

## 6. DIV

Returns integer or decimal value representing result of sequential dividing.

{% tabs %}
{% tab title="Usage" %}
`DIV(list_of_values OR value1, value2, ...)`&#x20;

Replace `list_of_values` argument with the list of numeric values (or pass numeric values as `value1`, `value2`, etc. arguments).&#x20;

{% hint style="info" %}
You can also pass combination of arrays and separate numeric arguments - they will be divided first and then results will be divided.
{% endhint %}
{% endtab %}

{% tab title="Example 1" %}
Let *x* = **450**, *y* = **10** and *z* = **15**.

`DIV({Stub__c.x}, {Stub__c.y}, {Stub__c.z})`  will return **3** (450 / 10 / 15).
{% endtab %}

{% tab title="Example 2" %}
Let *String* field stores following value: **'1200, 2, 10, 12'**.&#x20;

`DIV(SPLIT({Stub__c.String__c}, ','))` will return **5** (1200 / 2 / 10 / 12).
{% endtab %}

{% tab title="Example 3" %}
Let *String* field stores following value: **'\["24", "2", "3"]'** and *Area* field stores **'\["6", "3"]'**.&#x20;

`DIV(JPARSE({Stub__c.String__c}), JPARSE({Stub__c.Area__c}))` will return **2** ( (24 / 2 / 3) / (6 / 3) ).
{% endtab %}
{% endtabs %}

## 7. SQRT

Returns the positive square root of a given number.

{% tabs %}
{% tab title="Usage" %}
`SQRT(parameter)`&#x20;

Replace `parameter` with the field or expression you want computed into a square root.
{% endtab %}

{% tab title="Example" %}
`SQRT(26.5)` returns **5.1478150704935**.
{% endtab %}
{% endtabs %}

## 8. ABS

Calculates the absolute value of a number (a number without its positive or negative sign).

{% tabs %}
{% tab title="Usage" %}
`ABS(parameter)`&#x20;

Replace `parameter` with a field or numeric value that has the sign you want removed.
{% endtab %}

{% tab title="Example" %}
`ABS({Department__c.Expected_Revenue__c})` calculates the positive value of the *Expected Revenue* amount regardless of whether it is positive or negative.
{% endtab %}
{% endtabs %}

## 9. LOG

Returns the base 10 logarithm of a number.

{% tabs %}
{% tab title="Usage" %}
`LOG(parameter)`&#x20;

Replace `parameter` with the field or expression from which you want the base 10 logarithm calculated.
{% endtab %}

{% tab title="Example" %}
Let *{$Variables.Concentration}* = **10^-6**.&#x20;

`LOG({$Variables.Concentration})` will return **-6**.
{% endtab %}
{% endtabs %}

## 10. POW

Returns one value (*x*) raised to the power of another value (*y*), i.e. **x^y**.

{% tabs %}
{% tab title="Usage" %}
`POW(parameter, exponent)`&#x20;

Replace `parameter` argument with integer or double value that needs to be raised to the power of `exponent` argument.
{% endtab %}

{% tab title="Example 1" %}
`POW (8, 3)` will return **512**.
{% endtab %}

{% tab title="Example 2" %}
`POW (1000, -1/3)` will return **0.1**.
{% endtab %}
{% endtabs %}

## 11. MOD

Returns a remainder after a number is divided by a specified divisor.

{% tabs %}
{% tab title="Usage" %}
`MOD(parameter1, parameter2)`&#x20;

Replace:

`parameter1` with the field or expression you want to be divided;

`parameter2` with the number to use as the divisor.
{% endtab %}

{% tab title="Example" %}
`MOD(123, 100)` will return **23**.
{% endtab %}
{% endtabs %}

## 12. MIN

Returns the lowest number from several numeric values.

{% tabs %}
{% tab title="Usage" %}
`MIN(list_of_values OR value1, value2, ...)`&#x20;

Replace `list_of_values` argument with the list of numeric values (or pass numeric values as `value1`, `value2`, etc. arguments).&#x20;

{% hint style="info" %}
You can also pass combination of arrays and separate numeric arguments.
{% endhint %}
{% endtab %}

{% tab title="Example" %}
Let *String* field stores following value: **'\["12", "2", "3"]'** and *Area* field stores  **'\["6", "3"]'**.&#x20;

`MIN(JPARSE({Stub__c.String__c}), JPARSE({Stub__c.Area__c}))` will return **2**.
{% endtab %}
{% endtabs %}

## 13. MAX

Returns the highest number from several numeric values.

{% tabs %}
{% tab title="Usage" %}
`MAX(list_of_values OR value1, value2, ...)`&#x20;

Replace `list_of_values` argument with the list of numeric values (or pass numeric values as `value1`, `value2`, etc. arguments).&#x20;

{% hint style="info" %}
You can also pass combination of arrays and separate numeric arguments.
{% endhint %}
{% endtab %}

{% tab title="Example" %}
Let *String* field stores following value: **'\["12", "2", "3"]'** and *Area* field stores  **'\["6", "3"]'**.&#x20;

`MAX(JPARSE({Stub__c.String__c}), JPARSE({Stub__c.Area__c}), 9, 13)` will return **13**.
{% endtab %}
{% endtabs %}

## 14. ROUND

Returns the rounded approximation of a decimal value.

{% tabs %}
{% tab title="Usage" %}
`ROUND(decimal_value, CEILING|DOWN|FLOOR|UP|HALF_DOWN|HALF_UP)`&#x20;

Replace `decimal_value` with the decimal to be rounded, and pass one of the allowed rounding modes (`CEILING`, `FLOOR`, `DOWN`, `UP`, `HALF_DOWN`, `HALF_UP`).
{% endtab %}

{% tab title="Examples" %}
`ROUND(122.3456669, 'CEILING')` will return **123**\
`ROUND(-122.3456669, 'CEILING')` will return **-122**

`ROUND(122.3456669, 'FLOOR')` will return **122**\
`ROUND(-122.3456669, 'FLOOR')` will return **-123**

`ROUND(122.3456669, 'DOWN')` will return **122**\
`ROUND(-122.3456669, 'DOWN')` will return **-122**

`ROUND(122.3456669, 'UP')` will return **123**\
`ROUND(-122.3456669, 'UP')` will return **-123**

`ROUND(122.5, 'HALF_DOWN')` will return **122**\
`ROUND(-122.5, 'HALF_DOWN')` will return **-122**

`ROUND(122.5, 'HALF_UP')` will return **123**\
`ROUND(-122.5, 'HALF_UP')` will return **-123**
{% endtab %}
{% endtabs %}

## 15. SCALE

Returns the decimal scaled to the specified number of decimal places.

{% tabs %}
{% tab title="Usage" %}
`SCALE(decimal_value, decimal_places)`&#x20;

Replace:

`decimal_value` with decimal value you want scaled;

`decimal_places` with number of decimal places to be left.
{% endtab %}

{% tab title="Example 1" %}
Let *Salary* value = **122.3456669.**

`SCALE({User.Salary__c}, 2)` will return **122.35**.
{% endtab %}

{% tab title="Example 2" %}
Let *Number* value = **25**.&#x20;

`SCALE({Stub__c.Number__c}, 3)` will return **25.000**.
{% endtab %}
{% endtabs %}

## 16. RANDOM

Generates a random 19-digit number (positive or negative; negative number will also have a sign).

{% tabs %}
{% tab title="Usage" %}
`RANDOM()`&#x20;

This function doesn't require parameters.
{% endtab %}

{% tab title="Example" %}
`RANDOM()` will return a random 19-digit number like **2139744657709176245** or **-6535028942888403203**.
{% endtab %}
{% endtabs %}

## 17. FORMATNUMBER

Formats the decimal value to make it have readable view (adds thousands separators and removes leading zeroes).

{% tabs %}
{% tab title="Usage" %}
`FORMATNUMBER(decimal_value)`&#x20;

Replace `decimal_value` with decimal value you want to be formatted.
{% endtab %}

{% tab title="Example" %}
`FORMATNUMBER(-01233534343453.566)` will return **-1,233,534,343,453.566**.
{% endtab %}
{% endtabs %}
