Form Calculation – Math Function Reference

October 22, 2021

The Calculation Wizard’s Math Functions allow you to perform mathematical tasks. The following advanced mathematical functions are available on the Form Calculation Widget and when using the Update/Calculate Field condition. You can use this as your reference to build perfect calculation forms.

In the Form Calculation Widget:

In the Update/Calculate Field Condition:

Math Functions:

Math Properties:

Other Functions:

Tip: The numbers on the formula below can be replaced with the fields from your form as seen on the actual form when you test it. In other words, the numbers can either be defined on the formula or taken from the user input by adding your form fields.

Math Functions

abs()

This returns the absolute value of a number.

acos()

Calculates the arccosine of a number.

atan()

Calculates the arctangent of a number.

atan2()

This function calculates the arctangent of the quotient of its arguments.

ceil()

Round up a number to its nearest integer. If the value is a full number, it will not be rounded.

cos()

This returns the cosine of a number.

exp()

This function returns the value of Ex, where E is Euler’s number (approximately 2.7183) and x is the specified number.

floor()

This is the opposite of the ceil() function. This rounds down a number to its nearest integer.

log()

Returns natural logarithm.

max()

Output the number with the highest value.

min()

Output the number with the lowest value.

pow()

Power returns the value of x to the power of y. Example pow(2,3) means 2*2*2, which returns 8.

random

Returns a random number.

round()

Round a number to the nearest integer.

sin()

Return the sine of a number.

sqrt()

Output the square root of a number.

tan()

Calculate the tangent.

Math Properties

E

Return the Euler’s number.

LN2

Outputs the natural logarithm of 2, approximately 0.6931.

LN10

Outputs the natural logarithm of 10, approximately 2.3026.

LOG2E

Base-2 logarithm of E, approximately 1.4427.

LOG10E

Base-10 logarithm of E, approximately 0.4343.

PI

Return PI. This represents the ratio of the circumference of a circle to its diameter, approximately 3.14159.

SQRT1_2

Return the square root of 1/2 which is approximately 0.7071.

SQRT2

Return the square root of 2, approximately 1.4142.

Example: (√2), which results to 1.414

Other Functions

avg()

Returns the average value of the list of numeric values.

Function usage: avg(value 1, value 2, value 3)

Here’s an example calculation on my cloned form:

You can find the example avg() function here: https://www.jotform.com/70991655420964.

avgNoZero()

Calculate average value while excluding empty fields.

Function usage: avgNoZero(value 1, value 2, value 3)

Here’s an example calculation:

You can test this function on my cloned form here: https://www.jotform.com/70991655420964. Look for the avgNoZero() heading.

count()

Returns the number of rows that matches a specified criteria. This is usually used if you want to count the number of selections in a check box field.

Function usage: count(multiple choice field)

Here’s an example calculation:

You can test this on my cloned form here: https://www.jotform.com/70991655420964. Look for the count() function heading.

commaSeparate()

Include comma separators in large numbers.

Function usage: commaSeparate(number value)

Here’s an example case:

You can test this on my cloned form here: https://www.jotform.com/70991655420964. Look for the commaSeparate() function heading.

date()

Returns the sequential serial number that represents a particular date. You’ll need to use the default date picker field if you will be using date based functions.

Function usage: date(date field value)

Here’s an example case:

You can see this in action on my form here: https://www.jotform.com/70991655420964. Find the math function with header date() on it.

dateString()

Converts the DateTime value to a date string.

Function usage: dateString(date field value)

Here’s an example case:

You can see this in action on my cloned form here: https://www.jotform.com/70991655420964. Find the dateString() function heading.

nth()

The function will get the nth biggest field.

Function usage: nth(nth biggest, value 1, value 2, value 3)

On my settings and example, the first parameter is the nth biggest rule. In my case, I set it to “1”, which means I’ll get the 1st biggest value in the list of inputs I will set. You can see below I have 3 input boxes, the nth() function will get the 1st biggest value. If you want to get the 2nd highest or biggest value, then set the nth rule to 2.

You can test this on my cloned form here: https://www.jotform.com/70991655420964. Look for the nth() function heading.

More math function references – How to turn negative values to zero?

Was this guide helpful?
Contact Support:

Our customer support team is available 24/7 and our average response time is between one to two hours.
Our team can be contacted via:

Support Forum: https://www.jotform.com/answers/

Contact Jotform Support: https://www.jotform.com/contact/

Send Comment:

Jotform Avatar
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Comments: