---
title: Calculation Operators
description: The equations that you build as part of a SiteSpect Calculation use the following set of mathematical and logical operators.
---

[Skip to content](https://doc.sitespect.com/knowledge/calculation-operators#main-content)

English

Show submenu for translations

![Monetate-Logo-Full-Color-1](https://doc.sitespect.com/hs-fs/hubfs/Monetate-Logo-Full-Color-1.png?width=340&height=49&name=Monetate-Logo-Full-Color-1.png)

- [A/B Testing](https://www.sitespect.com/testing-and-experimentation/)
- [Personalization](https://www.sitespect.com/personalization-targeting/)
- [Recommendations](https://www.sitespect.com/recommendations/)

Open main navigation

Close main navigation

- [A/B Testing](https://www.sitespect.com/testing-and-experimentation/)
- [Personalization](https://www.sitespect.com/personalization-targeting/)
- [Recommendations](https://www.sitespect.com/recommendations/)
- English
  
  Show submenu for translations

 How can we help you?

- There are no suggestions because the search field is empty.

1. [Knowledge Base](https://doc.sitespect.com/knowledge?hsLang=en)
2. [Build](https://doc.sitespect.com/knowledge/build?hsLang=en)
3. [Metrics](https://doc.sitespect.com/knowledge/build?hsLang=en#metrics)

# Calculation Operators

The equations that you build as part of a SiteSpect Calculation use the following set of mathematical and logical operators.

| Operator | Description |
| --- | --- |
| **Mathematical Operators** |  |
| + | Addition |
| - | Subtraction |
| \* | Multiplication |
| / | Division |
| () | Grouping - Follows standard mathematical order of operation rules. |
| = | Equal to |
| <=> | NULL-safe equal to. Performs an equality comparison like the = operator but returns 1 rather than NULL if both operands are NULL and 0 rather than NULL if one operand is NULL. |
| <>, != | Not equal to |
| < | Less than |
| > | Greater than |
| <= | Less than or equal to |
| >= | Greater than or equal to |
| ROUND(n), ROUND(n, d) | Rounds the argument n to d decimal places. d defaults to 0 if it is not specified. |
| Logical Operators |  |
| AND, && | Logical AND. Returns 1 if all operands are nonzero and not NULL. Returns 0 if one or more operands is 0. Otherwise, it returns NULL. |
| OR, \|\| | Logical OR. When both operands are non-NULL, returns 1 if any operand is nonzero and 0 otherwise. If an operand is NULL, it returns 1 if the other operand is nonzero and NULL otherwise. If both operands are NULL, it returns NULL. |
| NOT, ! | Logical NOT. Returns 1 if the operand is 0; 0 if the operand is nonzero; NULL if the operand is NULL. |
| **Miscellaneous** |  |
| NULL | A NULL value represents an unknown variable in a Campaign. Any operation involving a NULL value results in NULL; a NULL value is not true in a test operation (e.g., NULL = NULL returns NULL, which evaluates to false). The Data Points for past visits to a Campaign when a Metric is added are NULL. The Value Capture Data Point for a Metric that did not match is NULL. When the location of a visit cannot be determined, the Geographic Location variables are NULL. Mobile device variables for non-mobile or unknown device users are NULL. |
| UNIX\_TIMESTAMP(), UNIX\_TIMESTAMP(date) | If called with no argument, returns the current Unix timestamp (seconds since 1970-01-01 00:00:00 UTC). If called with a date argument, it returns the value of the argument as seconds since 1970-01-01 00:00:00 UTC. date is a string in the format 'YYYY-MM-DD HH:MM:SS', or a number in the format YYYYMMDDHHMMSS. The date is interpreted as a value in UTC. This function is used with the Start Time variable to perform date calculations. For example, to test if a visit started within a time frame, use an equation such as: \[Start Time\] BETWEEN UNIX\_TIMESTAMP(20120701040000) AND UNIX\_TIMESTAMP(20120705035959). Remember to convert the dates to UTC. |
| COUNT\_STRING(match, source), | Finds the number of occurrences of match in the source string. Usage: (COUNT\_STRING('"PageMatch"',\[RP:1:CustomVariables\])) > 5 |
| **Tests** |  |
| IF(expr, then, else) | If expr is nonzero and NOT NULL then this returns then, otherwise it returns else. |
| IFNULL(expr, else) | If expr is not NULL then this returns expr, otherwise it returns else. expr LIKE pattern Performs pattern matching using SQL simple Regular Expression comparison. |
| % | Matches any number of characters, even zero characters. |
| \_ | Matches exactly one character. |
| \\% | Matches one "%" character. |
| \\\_ | Matches one "\_" character. |
| expr REGEXP pattern | Performs pattern matching using SQL Regular Expression comparison. SQL RegEx supports only a limited subset of SiteSpect's RegEx capabilities. Non-greedy quantifiers (.\*?) and escape characters (\\d) are not supported. |
| expr BETWEEN min AND max | If expr is greater than or equal to min and expr is less than or equal to max, BETWEEN this returns 1, otherwise it returns 0. |
| expr IS NULL, expr IS NOT NULL | Tests whether a value is (NOT) NULL (e.g., NULL IS NULL returns true). |

- [Get Started](https://doc.sitespect.com/knowledge/get-started?hsLang=en#main-content)
  
  
  
  
  
    - [SiteSpect Support](https://doc.sitespect.com/knowledge/get-started?hsLang=en#sitespect-support)
    - [Overview Information](https://doc.sitespect.com/knowledge/get-started?hsLang=en#overview-information)
    - [Intro to SiteSpect](https://doc.sitespect.com/knowledge/get-started?hsLang=en#intro-to-sitespect)
    - [Account Setup](https://doc.sitespect.com/knowledge/get-started?hsLang=en#account-setup)
    - [Artificial Intelligence](https://doc.sitespect.com/knowledge/get-started?hsLang=en#artificial-intelligence)
- [Dashboard](https://doc.sitespect.com/knowledge/dashboard?hsLang=en)
- [Build](https://doc.sitespect.com/knowledge/build?hsLang=en#main-content)
  
  
  
  
  
    - [Setting Up a Campaign](https://doc.sitespect.com/knowledge/build?hsLang=en#setting-up-a-campaign)
    - [Create a Client-Side Campaign](https://doc.sitespect.com/knowledge/build?hsLang=en#create-a-client-side-campaign)
    - [Create a Server-Side Campaign](https://doc.sitespect.com/knowledge/build?hsLang=en#create-a-server-side-campaign)
    - [Metrics](https://doc.sitespect.com/knowledge/build?hsLang=en#metrics)
    - [Audiences](https://doc.sitespect.com/knowledge/build?hsLang=en#audiences)
    - [Triggers](https://doc.sitespect.com/knowledge/build?hsLang=en#triggers)
    - [Variations](https://doc.sitespect.com/knowledge/build?hsLang=en#variations)
    - [Traffic Management](https://doc.sitespect.com/knowledge/build?hsLang=en#traffic-management)
    - [Preview](https://doc.sitespect.com/knowledge/build?hsLang=en#preview)
    - [Factors](https://doc.sitespect.com/knowledge/build?hsLang=en#factors)
    - [Advanced Settings](https://doc.sitespect.com/knowledge/build?hsLang=en#advanced-settings)
    - [Omnichannel](https://doc.sitespect.com/knowledge/build?hsLang=en#omnichannel)
    - [Regular Expressions (Regex)](https://doc.sitespect.com/knowledge/build?hsLang=en#regular-expressions-regex)
    - [WATTS](https://doc.sitespect.com/knowledge/build?hsLang=en#watts)
    - [Recommendations](https://doc.sitespect.com/knowledge/build?hsLang=en#recommendations)
- [Monitor](https://doc.sitespect.com/knowledge/monitor?hsLang=en)
- [Analyze](https://doc.sitespect.com/knowledge/analyze?hsLang=en#main-content)
  
  
  
  
  
    - [Data Export and Integration](https://doc.sitespect.com/knowledge/analyze?hsLang=en#data-export-and-integration)
    - [SiteSpect Reports](https://doc.sitespect.com/knowledge/analyze?hsLang=en#sitespect-reports)
- [Site](https://doc.sitespect.com/knowledge/site?hsLang=en#main-content)
  
  
  
  
  
    - [Tools](https://doc.sitespect.com/knowledge/site?hsLang=en#tools)
    - [Configuration](https://doc.sitespect.com/knowledge/site?hsLang=en#configuration)
- [Developers](https://doc.sitespect.com/knowledge/developers?hsLang=en#main-content)
  
  
  
  
  
    - [API Reference](https://doc.sitespect.com/knowledge/developers?hsLang=en#api-reference)
    - [Code Samples](https://doc.sitespect.com/knowledge/developers?hsLang=en#code-samples)
    - [Tips & Tricks](https://doc.sitespect.com/knowledge/developers?hsLang=en#tips-tricks)
- [Mobile](https://doc.sitespect.com/knowledge/mobile?hsLang=en)
- [Implementation, Deployment, and Security](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#main-content)
  
  
  
  
  
    - [How does SiteSpect work with CDNs?](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#how-does-sitespect-work-with-cdns)
    - [Single Tenant Implementations](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#single-tenant-implementations)
    - [Security Features](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#security-features)
    - [Deployment and Implementation Overview](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#deployment-and-implementation-overview)
    - [SiteSpect Engine & Admin API](https://doc.sitespect.com/knowledge/implementation-deployment-and-security?hsLang=en#sitespect-engine-admin-api)
- [Third-Party Integration](https://doc.sitespect.com/knowledge/third-party-integration?hsLang=en#main-content)
  
  
  
  
  
    - [Google](https://doc.sitespect.com/knowledge/third-party-integration?hsLang=en#google)
    - [Zuko](https://doc.sitespect.com/knowledge/third-party-integration?hsLang=en#zuko)
- [Troubleshooting](https://doc.sitespect.com/knowledge/troubleshooting?hsLang=en)
- [Releases](https://doc.sitespect.com/knowledge/releases?hsLang=en#main-content)
  
  
  
  
  
    - [Superfresh](https://doc.sitespect.com/knowledge/releases?hsLang=en#superfresh)
- [Feedback](https://doc.sitespect.com/knowledge/feedback?hsLang=en)

- [A/B Testing](https://www.sitespect.com/testing-and-experimentation/)
- [Personalization](https://www.sitespect.com/personalization-targeting/)
- [Recommendations](https://www.sitespect.com/recommendations/)

[![Monetate-Logo-Full-Color-1](https://doc.sitespect.com/hs-fs/hubfs/Monetate-Logo-Full-Color-1.png?width=200&height=29&name=Monetate-Logo-Full-Color-1.png "Monetate-Logo-Full-Color-1")](http://monetate.com)

<https://www.facebook.com/> <https://www.twitter.com/> <https://www.instagram.com/> <https://podcasts.apple.com/> [mailto:email@email.com](mailto:email@email.com)

Copyright © 2026, Monetate