Topo is capable to embed complex calculations like you know in Excel into the template.

**Step-by-Step Guide **

1. Click on “Actions” and then “Automatic Calculations”.

2. Click “+ Add Formula”.

A new row will appear and you can now type in the Target field and the Formula for this field. The field names have to match the names under "Available Fields" on the left side and each field has to be in brackets (as shown in Example below).

**Target**

Refers to where the result of the calculation should be displayed and you can only enter one target.

**Formula**

count / sum / avg / min / max / sqrt

floor = rounds up value to the nearest less value

ceil = rounds up value to the nearest greatest value

aql_samplesize_single

aql_allowed_single

aql_samplesize_double

aql_allowed_double

aql_double_rounds

**Example**

**Useful Syntax to write Formulas**

Assignments

Syntax | Meaning | Example |

x += y | Addition |
Quantity1 + Quantity2 |

x -= y | Subtraction |
Quantity1 - Quantity2 |

x *= y | Multiplication |
Quantity1 * Quantity2 |

x /= y | Division |
Quantity1 / Quantity2 |

Comparison

Syntax | Meaning | Example |

== | Equal |
x == y |

!= | Not Equal |
x != y |

=== |
Strict Equal |
x === y |

!== |
Strict Not Equal |
x !== y |

> |
Greater Than |
x > y |

>= |
Greater Than or Equal |
x >= y |

< |
Less Than |
x < y |

<= |
Less Than or Equal |
x <= y |

Logical

Syntax | Meaning | Example |

&& | Logical AND |
x and y have to be both true otherwise false |

|| | Logical OR |
x or y have to be true otherwise false |

! | Logical NOT |
if x is true it will turn to false and vice versa |

Conditional

Syntax | Meaning | Example |

? : | Conditional |
condition ? x : y If condition is true, it will have value x and if not y |

**Time Span Calculation**

Formula | Example |

timespan({x},{y}, "z") |
timespan({date1},{date2}, "d") We calculate the time difference between "date1" and "date2" in days. |

You need two date fields and one display field to show the result of the time difference.

We calculate the total days between two dates. In the formula this is indicated by "d" at the end. "d" stands for days.

If you want to calculate the time span in hours (h), minutes (m) or seconds (s), simply replace the letter between "..." and the result will change accordingly.

You can use this function to calculate working hours, travel time and many more.

## Comments

4 comments

Is there a function for square root? Thanks!

Hi Ronald,

The function for square root is "sqrt" and I added it into the guide.

Please feel free to contact us if you have any other questions.

Thanks, Winnie

Hello:

Could you please make short syntax (with parameters followed) for below 2 formulas, thanks in advance.

aql_samplesize_double

aql_allowed_double

Please sign in to leave a comment.