You are here:
Formula Operators
A formula is a mathematical relationship or rule expressed in symbols. With Marketing Cloud Intelligence, you can use formulas to create calculated measurements and dimensions when mapping your data. Operators specify the type of calculation to perform on the terms in a formula—such as addition, subtraction, multiplication, or division.
There are several types of formula operators available in Marketing Cloud Intelligence, as shown in the following tables:
| Operator Symbol | Operator Name | Description | Example |
|---|---|---|---|
| == | Equal | Checks to see if the values on both sides of the operator are equal. | "Foo" == "Foo" is true |
!= |
Not Equal | Checks to see if the values on both sides of the operator are not equal. | "foo" != "bar" is true |
> |
Greater Than | Checks to see if the value on the left side of the operator is greater than the value on the right. | 2 > 1 is true |
| < | Less Than | Checks to see if the value on the left of the operator is less than the value on the right side. | 1<2 is true |
| >= | Greater Than or Equal to | Checks to see if the value on the left side of the operator is greater than or equal to the value on the right side. | 1 >= 1 is true 6 >= 5 is true |
| <= | Less Than or Equal to | Checks to see if the value on the left side is less than or equal to the value on the right. | 2 <= 2 is true 2 <= 3 is true |
| Contains | Value Containment Check | Checks to see if the value on the left contains the value on the right. | “Foo” var contains "Foo" |
| Soundslike | Soundex Check | Performs a Soundex comparison between two strings. Allows you to search by sound key, when you know the pronunciation but not the spelling. | "foobar" soundslike "fubar" |
| Operator Symbol | Operator Name | Description | Example |
|---|---|---|---|
| && | Logical AND | Checks to see that the values on both sides of the operator are true. | foo && bar |
| || | Logical OR | Checks to see if either the value on the left or the right is true. | foo || bar |
| or | Logical OR | Checks a sequence of values for emptiness and returns the first non-empty value. (This operator, or at least its equivalent functionality, is referred to as the "elves operator" in other languages) | foo or bar or barfoo or 'N/A' |
| ~= | Regular Expression Match | Checks to see if the value on the left matches the regular expression on the right. | foo ~= '[a-z].+' |
| Operator Symbol | Operator Name | Description | Example |
|---|---|---|---|
| & | Bitwise AND | The & operator compares each binary digit of two integers and returns a new integer, with a 1 wherever both numbers had a 1 and a 0 anywhere else | Foo & 5 |
| | | Bitwise OR | The | operator compares each binary digit across two integers and gives back a 1 if either of them is 1. | Foo | 5 |
| ^ | Bitwise XOR | When calculating the resulting number, it again compares the binary digits of these numbers. If one or the other is a 1, it inserts a 1 into the result, otherwise, it will insert a 0. | Foo ^ 5 |
| Operator Symbol | Operator Name | Description | Example |
|---|---|---|---|
| + | Addition | Adds the value on the left to the value on the right Note: When Mapping it must be used in conjunction with the NUMBER() formula, as in the mapping, + is used for concatenation |
1 + 2 Returns: 3 |
| - | Subtraction. | Subtracts the value on the right from the value on the left. | 2 - 1 Returns: 1 |
| / | Division | Divides the number on the left by the number on the right | 2 / 1 Returns: 2 |
| * | Multiplication | Multiplies the number on the left by the number on the right | 2 * 1 Returns: 2 |
| % | Modulus | Divides the number on the left by the number on the right and returns the remainder. | 1 % 2 Returns: 1 |
| Operator Symbol | Operator Name | Description | Example |
|---|---|---|---|
| + | String Concatenation | Concatenation is the process of appending one string to the end of another string Note: In Calculated Measurements, + is used for addition (see explanation in Arithmetic Operators) |
'foo' + 'bar' Returns: 'foobar' |
| # | Concatenation Operator | Concatenates two literals as strings. | 1 # 2 returns: '12' |
| = | Assignment | Assigns the value on the right to the variable on the left. | var = 'foobar' |

