ProTip: How to Use Conditional Logic in Automatic Calculations

ProTip: How to Use Conditional Logic in Automatic Calculations

One of the biggest benefits of a mobile form is automating calculations - it saves you considerable amounts of time by ‘doing the math’ for you and unlike manual calculations, always tallies accurate results. One of the most helpful calculation types in GoFormz is an ‘IF’ function, through which you can apply conditional logic

ProTip: 3 Automatic Formulas For Your Mobile Forms That You Should Know About

Your mobile forms can automatically do math for you. Automating your calculations saves you lots of time and provides you with accurate numbers. Many of the formulas used by GoFormz users are quite simple and easy to add to your mobile forms. Here are three easy-to-master formulas that you can implement in your forms today.

1. Simple Arithmetic

Basic arithmetic (addition, subtraction, multiplication and division) can very easily be included in fields on your mobile forms. In your Form Template in the Template Editor, select the field you want to add a calculation to and enter your formula into the Default Value setting in the Field Properties table.  Here’s some very basic examples to show you how simple the syntax is:

Addition: =5+5 will automatically calculate 10 when the form is created

Subtraction: =10-5 will automatically calculate 5 when the form is created

Multiplication: =5*5 will automatically calculate 25 when the form is created

Division: =10/5 will automatically calculate 2 when the form is created

2. Formulas That Use Fields (& Tables) on Your Form

Ok, so the formulas above are nice and easy, but it’s rare that you want just a single value across all of your forms (and really, why have a formula that always adds 5+5, when the answer is always 10??). What you really want to know how to do is to have a field perform calculations based on what’s in other fields on your form. For example, say you are filling out a Job Proposal form and are estimating the cost for Material & Parts:

Most likely you will be using a table like the one above. Quantity represents how many materials or parts you need and Price is the cost per unit. Here’s how to calculate the Total for each line item and then a grand total.

Select the table in the Template Editor and open up the Table Columns Menu by double clicking on the Columns box located in the Field Properties:

The menu will open and will look like this:

Click on the Total column (or whatever is the column you wish to have the calculation performed for) to open that specific column’s Properties

 /* Style Definitions */
	{mso-style-name:"Table Normal";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
     NOTE: Default Value 1 here represents the 1st field in the Total Column since it is the one selected.

NOTE: Default Value 1 here represents the 1st field in the Total Column since it is the one selected.

To specify the calculation for your first row’s total, you type this formula into the Default Value 1 box:

      =[2][1]*[3][1] which specifies: multiply the value in column 2 row 1 with the value in column 3 row 1

      The [ ] are used to reference the values found within the table

Repeat this for each subsequent cell you wish to add a Total formula to. For example, for the second Total box, you would type

      =[2][2]*[3][2] which specifies: multiply the value in column 2 row 2 with the value in column 3 row 2

For the third Total box, the formula would be:

      =[2][3]*[3][3] (multiply the value in column 2 row 3 with the value in column 3 row 3)

And so on.

Now that you know how to create formulas for Totals for each row, this is how you set your form to automatically calculate the Grand Total.   Create a new Number field (separate from the table) where the Grand Total will go. In this case, that field is named Sum M&P:

Select this field and in the Field Properties panel, type the following for the Default Value setting:


o      =SUM() will sum what is contained inside the parenthesis

o      [L&S]! references the table, using the syntax of [TableName]! where the name of the table is what is inside the brackets (our table is called L&S).

o      [4][1]:[4][4] references the range in a table column to add together. In other words, adds the values in column 4 row 1 through column 4 row 4.

3. Rounding Formula

Now that you know how to calculate your numbers, here’s how to round them in order to have cleaner numbers (this is especially useful when dealing with currency). This is a simple add-on to what you have already created. Wherever your current formula is located, you will just add:

      =ROUND((Current Formula), 2)

o      =ROUND() will perform the rounding function

o      The , 2 represents the number of decimal places you want to round to (in our case, we are rounding to two decimal places)

      So if you wanted to round the totals from the previous formula related to Material & Parts to two decimal places, you would type it out like this:

o      =ROUND(SUM([L&S]![4][1]:[4][4]), 2)

Add these formulas to your forms today and start saving time and consistently generating accurate totals!