Form Calculation: Math Function Reference

July 17, 2024

Mathematical as well as date and time functions are available in the Form Calculation widget and Update/Calculate Field conditional logic. You can use this guide as your reference to build perfect calculation forms.

To use math functions in Form Calculation or Update/Calculate Field

  1. Select the function icon in the formula editor.
The Form Calculation widget's function icon in Jotform Form Builder
Form Calculation
The Update/Calculate Field's function icon in Jotform Form Builder
Update/Calculate Field
  1. In the functions dialog, search and choose your desired function.
The Form Calculation widget's function search dialog in Jotform Form Builder
Form Calculation
The Update/Calculate Field's function search dialog in Jotform Form Builder
Update/Calculate Field

The functions’ arguments can either be fixed or variable from your form fields.
Here are the available functions:

Function Description
abs() Returns the absolute (positive) value of a number.
abs(-100) = 100
acos() Returns the arc cosine of a number.
acos(0.5) = 1.05
asin() Returns the arc sine of a number.
asin(0.5) = 0.52
atan() Returns the arc tangent of a number in radians.
atan(1) = 0.7854
atan2() Returns the arc tangent of two variables, similar to calculating the arc tangent of y/x.
atan2(4, 8) = 0.4636
ceil() Rounds a number up to the nearest integer.
ceil(1.3) = 2
cos() Returns the cosine of a number.
cos(2) = -0.42
exp() Returns e raised to the power of a given number.
exp(1) = 2.7183
floor() Rounds a number down to the nearest integer.
floor(1.7) = 1
log() Returns the natural logarithm of a number.
log(2) = 0.69
max() Returns the highest value from a set of numbers.
max(4, 8, 2) = 8
min() Returns the lowest value from a set of numbers.
max(1, 2, 5) = 1
pow() Returns a number raised to the power of a given exponent.
pow(2, 3) = 8
random() Generates a random float between 0 and 1.
random() * 100 = a random number between 0 and 100
round() Rounds a number to the nearest integer.
round(2.5) = 3
sin() Returns the sine of a number.
sin(3) = 0.14
sqrt() Returns the square root of a number.
sqrt(25) = 5
tan() Returns the tangent of a number.
tan(45) = 1.62
E Return the Euler’s number.
E * 1 = 2.7183
LN2 Returns the natural logarithm of 2.
LN2 * 1 = 0.6931
LN10 Returns the natural logarithm of 10.
LN10 * 1 = 2.3026
LOG2E Returns the base-2 logarithm of E.
LOG2E * 1 = 1.4427
LOG10E Returns the base-10 logarithm of E.
LOG10E * 1 = 0.4343
PI Returns the value of PI.
PI * 1 = 3.1416
SQRT1_2 Return the square root of 1/2.
SQRT1_2 * 1 = 0.7071
SQRT2 Return the square root of 2.
SQRT2 * 1 = 1.4142
avg() Returns the average of supplied numbers.
avg(0, 2, 4) = 2
avgNoZero() Returns the average of supplied numbers while excluding zeroes and empty fields.
avgNoZero(0, 2, 4) = 3
count() Returns the number of selected options in a Multiple Choice or Single Choice element.
commaSeparate()  Include comma separators in large numbers.
commaSeparate(1234567) = 1,234,567.00
dateString() Converts a Date Picker‘s value (or epoch time in days) to a date string in “D M d Y” format.
dateString({Date Picker}) returns the Date Picker’s date in “D M d Y” format, like Wed Dec 25 2030.
addDays() Adds days to a Date Picker or Appointment element’s value. 
addDays({Date Picker}, 2) returns the Date Picker’s date plus two days, like Fri Jan 19 2024.
subtractDays() Subtracts days from a Date Picker or Appointment element’s value.
subtractDays({Appointment}, 2) returns the Appointment’s date minus two days, like Mon Jan 15 2024.
nth() Returns the nth largest value from a set of numbers.
nth(2, 20, 30, 40) = 30
minutes() Converts minutes to milliseconds.
minutes(1) = 60000
hours() Converts hours to milliseconds.
hours(1) = 3600000
days() Converts days to milliseconds.
days(1) = 86400000
weeks() Converts weeks to milliseconds.
weeks(1) = 604800000
months() Converts months to milliseconds.
months(1) = 2592000000
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:

  • Korey - Profile picture
  • AJ Moolman - Profile picture
  • AJ Moolman - Profile picture
  • Korey - Profile picture
  • Brian Mali - Profile picture
  • Akif Altundal - Profile picture
  • PhxTMD Contradance - Profile picture
  • Danny - Profile picture
  • McLorg - Profile picture
  • Mercedes Anahi Spataro - Profile picture
  • Koelsch - Profile picture
  • Roald v.d. Munt - Profile picture
  • Jeni - Profile picture
  • Josh - Profile picture
  • David - Profile picture
  • CYNTHIA RAQUEL ALARCON MARTIN - Profile picture
  • JoshS - Profile picture
  • Dan Miller - Profile picture
  • Kelly Armstrong - Profile picture
  • Lynda Gould - Profile picture
  • cynthia - Profile picture
  • Eric Kulbeck - Profile picture
  • Jotform Jotform - Profile picture
  • Rabia Faisal - Profile picture
  • Kenneth Murray - Profile picture