Skip to main content
All CollectionsAdvanced Guides
Calculator: Advanced Functions and Conditional Operators
Calculator: Advanced Functions and Conditional Operators

Learn How to Use the Calculator’s Advanced Features

Elod avatar
Written by Elod
Updated yesterday

Available on

❌ Free

✅ Basic

✅ Pro

✅ Business

Advanced Functions

You'll find these advanced functions listed on the right side panel of the Calculator's formula builder. A short description is displayed as well when hovering above an operator on the side panel.

Name

Description

Syntax Example

MAX

Returns the largest of all input numbers

MAX(Q1,Q2,5,...)

MIN

Returns the smallest of all input numbers

MIN(Q1,Q2,5,...)

ROUND

Rounds input numbers to decimal places

ROUND(number,precision)

POW

Power of / exponent function

POW(number,exponent)

RAND

Returns a random number from a specified range

RAND(min,max,precision)

FLOOR

Returns the next lowest integer value by rounding down

FLOOR(1.12345)

CEIL

Returns the next highest integer value by rounding up

CEIL(1.12345)

ROOT

Square root (√) of a number

ROOT(Q1)

LOG

Base 2 logarithm of a number

LOG(Q1,10)

LOG10

Base 10 logarithm of a number

LOG10(Q1)

LN

Natural logarithm of a number

LN(Q1)

COUNT

Function to check how many answers were given or files were uploaded. Can only be used with Multiple Choice, Image Choice and File Upload elements.

COUNT(Q1)

DAYS

Function to calculate how many days are in the range of two dates (including both dates). Can only be used with Date & Time elements.

DAYS(Q1,Q2)

Conditional Logic Operators

Name

Description

Syntax Example

IF/THEN

Conditional Logic

IF(condition, then case, else case)

The conditions below can only be used inside the first parameter of an IF function:

Symbol

Description

Syntax Example

Example Result

>

Greater than

Q1>1

Is true if Q1 is greater than one

<

Smaller than

Q1<1

Is true if Q1 is smaller than on

>=

Equals or greater than

Q1>=1

Is true if Q1 is greater than one or equals one

>=

Equals or smaller than

Q1<=1

Is true if Q1 is smaller than one or equals one

<>

Is different than / is not (negation)

Q1<>5

Is true if Q1 is not 5

=

Equals to

Q1=5

Is true if Q1 is 5

AND

Logical operator that combines two conditions. Is true if both conditions are true

AND(Q1>1,Q1<10)

Is true of Q1 is greater than 1 and Q1 is smaller than 10

OR

Logical operator that combines two conditions. Is true when one of two conditions is true

OR(Q1<5,Q1>10)

Is true of Q1 is smaller than 5 or Q1 is greater than 10

ANSWERED

Function to check if the question was answered

ANSWERED(Q1)

Is true if Q1 was answered

NOT

Function to check if the negation of a value is true

NOT(Q1)

Is true if Q1 is false

CHECKED

Function to assert if an Opt-in Checkbox element was CHECKED, meaning the checkbox was ticked.

CHECKED(Q1)

Is true if Q1 was ticked (and Q1 is an Opt-in checkbox element).

CONTAINS

Function to check if a Free Text Input element contains text (in full or partially).

CONTAINS(Q1,"needle")

Is true if Q1 contains the text "needle" (and Q1 is a Free Text Input element which collects text input).

Can be nested to be negated: NOT(CONTAINS(Q1,"needle"))

BEFORE

Function to check if a Date&Time element was answered with a value before a given date/time.

BEFORE(Q1,"2023-01-01")

Is true if Q1 was answered with a date earlier than "2023-01-01" (and Q1 is a Date&Time element.

AFTER

Function to check if a Date&Time element was answered with a value after a given date/time.

AFTER(Q1,"2023-01-01")

Is true if Q1 was answered with a date later than "2023-01-01" (and Q1 is a Date&Time element.

PAST

Function to check if a Date&Time element was answered with a value in the past (at the time of evaluation).

PAST(Q1)

Is true if Q1 was answered with a date earlier than now (and Q1 is a Date&Time element).

FUTURE

Function to check if a Date&Time element was answered with a value in the future (at the time of evaluation).

FUTURE(Q1)

Is true if Q1 was answered with a date later than now (and Q1 is a Date&Time element).

NOW

Function returns current Date&Time.

NOW()

BEFORE(Q1,NOW()) is true if Q1 is a date earlier dan the current date.

These advanced functions will allow you to build more customized calculations. You'll find some example formulas for different use cases below:

Use Case Examples

Quantity Dependent Shipping Price Calculator

Calculator formula: =IF(Q2>5,Q1*Q2+10,IF(Q2>3,Q1*Q2+5,Q1*Q2+2))

Where Q1 is the price of the selected item, and Q2 is the quantity of the items ordered.

In the example above, two nested IF functions are used to check for the quantity ordered.

The leftmost IF function checks if there are more than 5 items in the order. If true, $10 will be charged for shipping, which is added to the ordered products' price. If the condition isn't true (less than 6 items ordered), the nested IF function checks if the amount of items is more than 3, in which case $5 will be charged for shipping. If the nested IF function's condition isn't true, the else case will be calculated, which charges $2 for shipping.

Coupon Code Checker

Calculator formula: IF(CONTAINS(Q2,'COUPONCODE'),Q1*0.8,Q1)

Where Q1 is the price of the selected product, and Q2 is the coupon code entered by the participant.

In the example above, the CONTAINS function checks if Q2 includes the predefined text, which is COUPONCODE in this case. If a match is found, the formula applies a 20% discount to the chosen product's value (achieved by the multiplication with 0.8).

If no match is found, the calculator's output will be the full value of the chosen product (Q1).

You'll find more use case examples in our blog post.

Did this answer your question?