/ /

Form Calculation - Math Function Reference

# Form Calculation - Math Function Reference

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:

abs(), acos(), asin(), atan(), atan2(), ceil(), cos(), exp(), floor(), log(), max(), min(), pow(), random(), round(), sin(), sqrt(), tan()

MATH PROPERTIES:

E, LN2, LN10, LOG2E, LOG10E, PI, SQRT1_2, SQRT2

OTHER FUNCTIONS:

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

MATH FUNCTIONS

1. abs()

This returns the absolute value of a number.

Example Formula:

abs(-100)

2. acos()

Calculates the arccosine of a number.

Example Formula:

acos(0.5)

3. asin()

Calculates the arcsine of a number.

Example Formula:

asin(0.5)

4. atan()

Calculates the arctangent of a number.

Example Formula:

atan(1)

5. atan2()

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

Example Formula:

atan2(4,8)

6. ceil()

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

Example Formula:

ceil(1.5)

7. cos()

This returns the cosine of a number.

Example Formula:

cos(2)

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:

exp(1)

9. floor()

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

Example Formula:

floor(1.5)

10. log()

Returns natural logarithm.

Example Formula:

log(2)

11. max()

Output the number with the highest value.

Example Formula:

max(1,2,5)

12. min()

Output the number with the lowest value.

Example Formula:

min(1,2,5)

13. pow()

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

Example Formula:

pow(2,3)

14. random

Returns a random number.

Example Formula:

random*100000

15. round()

Round a number to the nearest integer.

Example Formula:

round(2.5)

16. sin()

Return the sine of a number.

Example Formula:

sin(3)

17. sqrt()

Output the square root of a number.

Example Formula:

sqrt(25)

18. tan()

Calculate the tangent.

Example Formula:

tan(45)

MATH PROPERTIES

1. E

Return the Euler's number.

Example Formula:

E or (E*2)

2. LN2

Outputs the natural logarithm of 2, approximately 0.693

Example Formula:

LN2 or (LN2*1)

3. LN10

Outputs the natural logarithm of 10, approximately 2.302

Example Formula:

LN10 or (LN10*1)

4. LOG2E

Base-2 logarithm of E, approximately 1.442

Example Formula:

LOG2E or (LOG2E*1)

5. LOG10E

Base-10 logarithm of E, approximately 0.434.

Example Formula:

LOG10E or (LOG10E*1)

6. PI

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

Example Formula:

PI or (PI*1)

7. SQRT1_2

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

Example: (√0.5), which results to  0.707

Example Formula:

SQRT1_2 or (SQRT1_2*1)

8. SQRT2

Return the square root of 2, approximately 1.414.

Example: (√2), which results to  1.414

Example Formula:

SQRT2 or (SQRT2*1)

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

### Send Comment

• formuaep

I want to use de Date() function. So i try your form https://www.jotform.com/70991655420964 but when i fill the date field i don't receive any value in the calculation using date() field.

I have the same problem in my form.

Could you tell me if i'm doing it right?.

• NorthCornwallFestival

Is there a way to select multiple fields to add together in one go rather than having to add each individually? For example in Excel you'd do (a:z), I'd like to select multiple fields to add together.

• GAIDOCS

I am simply trying to add a row if numbers, and then multiply that number by the hourly rate for a total.
Thanks
Steven

• pablo_randel

Hi everyone

I'm working on a form for a contest, people will populate the blank space with the amount of their purchase at the store. This number needs to be divisible by 15. The result has to be rounded to the nearest whole number. The dynamic is that each purchase of 15 gives them 1 ticket for the contest.

So if they spend 20 will have just 1 ticket, if they spend 29 will have 1 ticket, it will change to 2 only if they spend 30, 3 for 45, etc.

Is there a way to calculate this?

• katurahp

Is there a way to make the OUTPUT number a percentage?

I need to calculate what percentage of (field A), (field B )is
In other words
Field A = \$500,000
Field B = \$100,000
Output Should be = 20%

Any way to do this?

• Arnoldas Rūškys

How to calculate uploaded files count and use it in Form Calculation?

• TimGNO

How do you produce the 'comma' separator between field names, for use with functions like MAX()? Whenever I type a comma using my keyboard, it appears both in the Form Calculation Widget editor and on the form itself as 'text'. Whereas the example of MAX() shown on this page seems to require a special 'comma' character that I do not see on the Widget's virtual keypad!

• HBSPASS

I have an input table that I have each field set to Numerical Text Fields. I have the calculation per row working but what I want is if the user inputs "-" (minus operator) before the value that it auto subtracts that instead of add?
example: +/- value +/- value = +/- total.
Any help on this would be greatly appreciated.
Anthony O' Brien.

• kyleb7777

Is there a roundup calculation?

• nouyoung33

First day , Full days , Last day, Per Diem rate, Sub total
==========================================================
I would like to create Travel Per Diem request form by automatically calculate the total per diem, total of 5 column
the formula will be
Sub total=(per diem rate*0.75*first day)+(per diem rate*full days)+(per diem*0.75*last day)
Also
The last row will also auto calculate the Per diem amount added from sub total.

• telmo_gomes

Tenho um formulário com 3 datas para as pessoas seleccionarem uma.
gostaria de saber se é possível colocar o número de pessoas que já escolheram cada uma das datas.

• Brother2Brother

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.

• realtomsamsher

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?

• ImaginarteLaminas

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

• BVHall

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?

• sbufsaweb

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

• Rhuan Carneiro

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

• info@pdfn.co

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.

• iftach

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

• coachlee

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.

• Hfplus

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

• acpacentertix

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?

• Wolverin89

cool! thanks!

• billwiese

Can I calculate the days between two dates?

• ozgurerdogan2

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

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

I need function for %

• Tara Anderson

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

• mlps

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

• How to add interest to calculate?

• betocaceres

hermoso, gracias

• cheekyface

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.

• lawrencecfp

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.

• jmagana

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