Form Calculation - Math Function Reference

Last Update: April 15, 2017

Calculation Wizard "More Math functions" allows you to perform mathematical tasks. The following advanced mathematical functions are available on the Form Calculation Widget and in the Conditions->Update/Calculate a Field option. You can use this as your reference to build perfect calculation forms.

In Form Calculation widget:

 

 

In Conditions->Update/Calculate a Field:

 

Supported Math Functions are:

abs, acos, asin, atan, atan2, ceil, cos, exp, floor, log, max, min, pow, random, round, sin, sqrt, tan, E, LN2, LN10, LOG2E, LOG10E, PI, SQRT1_2, SQRT2

Other Math Functions included: 

avg(), avgNoZero(), count(), commaSeparate(), date(), dateString(), nth()

**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 take it from the user input by adding your form fields. 

1. abs

This returns the absolute value of a number.

Example Formula:

Example Form:

http://www.jotform.com/form-templates/get-numbers-only-form 

 

2. acos

Calculates the arccosine of the inputted number. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/get-arccosine-acos-form 

 

3. asin

Calculates the arcsine of a number.

Example Formula:

Example Form:

http://www.jotform.com/form-templates/get-arcsine-asin-form 

 

4. atan

Calculates the arctangent of the entered number.

Example Formula:

Example Form:

http://www.jotform.com/form-templates/get-arctangent-atan-form 

 

5. atan2

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

Example Formula:

Example Form:

http://www.jotform.com/form-templates/calculate-arctangent2-atan2-form 

 

6. ceil

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

Example Formula:

Example Form:

http://www.jotform.com/form-templates/round-decimals-upward 

 

7. cos

This returns the cosine of a specified number. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/get-cosine-cos-form 

 

8. exp

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

Example Formula:

Example Form:

http://www.jotform.com/form-templates/get-euler-s-number-exp 

 

9. floor

This is opposite to ceil function. This rounds number downward to its nearest integer.

Example Formula:

Example Form:

http://www.jotform.com/form-templates/round-decimals-downward-form 

 

10. log

Returns natural logarithm. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/get-logarithm-log-form 

 

11. max

Output the number with the highest value. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/find-the-highest-value 

 

12. min

Output the number with the lowest value. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/find-the-lowest-value 

 

13. pow

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

Example Formula:

Example Form:

http://www.jotform.com/form-templates/exponent-power-calculation-form 

 

14. random

Return a random number. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/generate-random-number-2 

 

15. round

Round number to the nearest integer. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/round-off-number 

 

16. sin

Return the sine of a number. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/get-sine-sin 

 

17. sqrt

Output the square root of a number 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/square-root-calculator-form 

 

18. tan

Calculate the tangent. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/get-tangent-tan 

 

19. E

Return the Euler's number. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/euler-s-e-number-calculator-form 

 

20. LN2

Outputs the natural logarithm of 2, approximately 0.693 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/logarithm2-ln2-sample-form 

 

21. LN10

Outputs the natural logarithm of 10, approximately 2.302

Example Formula:

Example Form:

http://www.jotform.com/form-templates/logarithm10-ln10-sample-form 

 

22. LOG2E

Base-2 logarithm of E, approximately 1.442 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/base-2-logarithm-of-e-log2e-calculation-form 

 

23. LOG10E

Base-10 logarithm of E, approximately 0.434. 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/base-10-logarithm-of-e-log10e-calculation-form 

 

24. PI

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

Example Formula:

Example Form:

http://www.jotform.com/form-templates/pi-p-calculation-form 

 

25. SQRT1_2

Return the square root of 1/2 which is approximately 0.707

Example: (√0.5), which results to  0.707 

Example Formula:

Example Form:

http://www.jotform.com/form-templates/get-the-square-root-of-1-2-with-sqrt1-2 

 

26. SQRT2

Return the square root of 2, approximately 1.414.

Example: (√2), which results to  1.414 

Example Formula:

 

Example Form:

http://www.jotform.com/form-templates/multiply-the-number-with-square-root-of-2-sqrt2 

 

Other Math Functions:

1. 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://form.jotformpro.com/70991655420964

 

2. 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://form.jotformpro.com/70991655420964. Look for the avgNoZero() heading. 

 

3. 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://form.jotformpro.com/70991655420964. Look for the count() function heading. 

 

4. 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://form.jotformpro.com/70991655420964. Look for the commaSeparate() function heading. 

 

5. 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://form.jotformpro.com/70991655420964. Find the math function with header date() on it. 

 

6. 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://form.jotformpro.com/70991655420964. Find the dateString() function heading. 

 

7. 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://form.jotformpro.com/70991655420964. Look for the nth() function heading. 

 

More math function references:

How to turn negative values to zero?

http://www.w3schools.com/jsref/jsref_obj_math.asp 

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math 


22 Comments...


   
jmagana (March 19, 2014 at 07:47 AM)

Is there a way that on the final output or answer to the math calculation that I can have it show the dollar sign and decimal point?
If so how do I do that?
Thanks
Joe

View Answer


   
lawrencecfp (March 19, 2014 at 11:55 PM)

If you have multiple check boxes, how do you assign a unique value to each item in the check box. For example, say you have red, blue, and yellow as check box options. How then do you assign a unique value to each color, so that when a person clicks on the color, its associated value is added to the calculation. In Excel, this would be done with an IF,THEN function.

View Answer


   
cheekyface (March 27, 2014 at 09:13 AM)

Can you show how to use this to generate a unique number for every submission? I want to have a quote form that gives users a reference they can use for self-quoting.

View Answer


   
betocaceres (June 10, 2014 at 03:51 PM)

hermoso, gracias


   
Adrian14 (July 21, 2014 at 03:08 PM)

How to add interest to calculate?

View Answer


   
mlps (July 22, 2014 at 08:09 AM)

Is there the possibility of a math function which returns the current date and time?

View Answer


   
Tara Anderson (September 03, 2014 at 05:24 AM)

Can you do if statements?
If they answered ___ do field*__
If ___*___???

View Answer


   
ozgurerdogan2 (March 26, 2015 at 11:16 AM)

What must I choose for:
(FieldA+FieldB)-10%=

For example
(50+50)-10%=90

I need function for %

View Answer


   
billwiese (May 18, 2015 at 07:54 AM)

Can I calculate the days between two dates?

View Answer


   
accountax (May 29, 2015 at 09:02 AM)

Problem:

FieldA = 1 to unlimited(filled by user)

FieldB = filedA but maximum to 10000

View Answer


   
Wolverin89 (August 19, 2015 at 03:44 PM)

cool! thanks!


   
acpacentertix (August 29, 2015 at 06:56 PM)

I need to round up to the nearest $0.25; but the Ceiling function only allows me to round up to the nearest whole number. How can I do this?

View Answer


   
Hfplus (September 30, 2015 at 10:06 AM)

We need to find the total number of hours and minutes between start time and end time. What would the calculation look like for this?

We are using the i0s7 Time widget:

Start time 9:30 AM and End time 2:30 PM total hours is: 4.00

View Answer


   
coachlee (October 13, 2015 at 04:29 PM)

Id like to add up the values inserted in 3x fields and display it in a forth for each row of a matrix grid.

Im basically creating a stat sheet which i can embed to my basketball club's website to allow team admin members to enter stats of their game scoresheets.

View Answer


   
iftach (December 08, 2015 at 03:20 AM)

Is there option to make something like 0.137 round to 0.1 and 0.987 round to 0.9?

View Answer


   
info@pdfn.co (March 11, 2016 at 06:50 AM)

Is it possible to output a fiksed value to a field, if calculation for it results in lower value? For example if a+b < 10, then output 10, if not output result for a+b

Thank you.

View Answer


   
Rhuan Carneiro (March 16, 2016 at 04:00 PM)

how can add percentage in a certain amount that will be filled?

View Answer


   
sbufsaweb (June 08, 2016 at 11:40 AM)

Is it possible to give an error if the calculation total is less than 6 or greater than 20?

View Answer


   
BVHall (June 29, 2016 at 12:10 PM)

I'm using the Configurable List widget to allow a user to add different booking dates for a room.
It simply displays the date to select, then the user clicks the + button to add another date and so on.
What I then need to do is to count the number of dates added and multiply that by another field (the cost of a room) to give a total cost.
What I cannot figure out is how to add up the number of dates entered by the user (ie if he has entered 5 different dates then I need to use the figure 5 to calculate the total cost).
How can I do this please?

View Answer


   
ImaginarteLaminas (August 29, 2016 at 09:18 PM)

Se pueden sumar las cantidades ingresadas en un formulario "lista configurable" gracias


   
realtomsamsher (December 01, 2016 at 12:08 AM)

how can i do (fieldA+fieldB) times the number of fields added?
so if there was three A,B,C it would be (fieldA+fieldB+fieldC)3 cause there are three fields?

View Answer


   
Brother2Brother (July 04, 2017 at 02:41 PM)

Hi, I am having difficulty with the form calculation for a satisfaction survey where V. Satisfied=4, Satisfied=3, Neutral=0, Dissatisfied=2 and V. Dissatisfied=1. Also, what would be the best way to display this data (i.e., pie, chart, etc) I'd like to see the number of responses for each question.
Please help. Thanks.

View Answer


Send Comment