# 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, whereEis Euler's number (approximately 2.7183) andxis 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

xto the power ofy. Examplepow(2,3)means2*2*2, which returns8.

Example Formula:pow(2,3)

14. randomReturns 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. EReturn the Euler's number.

Example Formula:E or (E*2)

2. LN2Outputs the natural logarithm of 2, approximately 0.693

Example Formula:LN2 or (LN2*1)

3. LN10Outputs the natural logarithm of 10, approximately 2.302

Example Formula:LN10 or (LN10*1)

4. LOG2EBase-2 logarithm of E, approximately 1.442

Example Formula:LOG2E or (LOG2E*1)

5. LOG10EBase-10 logarithm of E, approximately 0.434.

Example Formula:LOG10E or (LOG10E*1)

6. PIReturn 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_2Return 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. SQRT2Return 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.

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

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

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

**Contact Support:**

gouldcaHi, I have the same question someone had earlier, but it does not look like it was answered. Here is my equation:

p=Z^5.2559

As I understand, the equation will look like: pow(Z,5.2559)

My problem is when I select the "pow" function, it gives "pow()". What I need is "pow(,)". I cannot figure out how to get the comma in between the parenthesis.

formuaepI 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?.

NorthCornwallFestivalIs 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.

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

Can you advise, I have read everything and tried several things.

Thanks

Steven

pablo_randelHi 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?

Thanks for your help in advance!

katurahpIs 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?

Thanks for your help!

Arnoldas RūškysHow to calculate uploaded files count and use it in Form Calculation?

TimGNOHow 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!

HBSPASSI 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.

kyleb7777Is there a roundup calculation?

nouyoung33First 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.

Please help, tks

telmo_gomesTenho 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.

Obrigado

Brother2BrotherHi, 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.

realtomsamsherhow 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?

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

BVHallI'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?

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

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

info@pdfn.coIs 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.

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

coachleeId 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.

HfplusWe 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

acpacentertixI 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?

Wolverin89cool! thanks!

billwieseCan I calculate the days between two dates?

ozgurerdogan2What must I choose for:

(FieldA+FieldB)-10%=

For example

(50+50)-10%=90

I need function for %

Tara AndersonCan you do if statements?

If they answered ___ do field*__

If ___*___???

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

Adrian14How to add interest to calculate?

betocacereshermoso, gracias

cheekyfaceCan 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.

lawrencecfpIf 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.

jmaganaIs 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