SeaTable formulas provide you with various ways to work with the data in your tables. For example, formulas can be used to automatically determine the time between two dates. By entering a corresponding formula, you can thus calculate the duration of your vacation, among other things, and add it to a formula column of your table.

## Calculate duration of a vacation #

In the concrete example, the goal is to use a formula to calculate the **duration of** the **vacations** collected in the table.

To do this, first add a *formula column* to the table, in whose text field you can then add any **formula**.

To calculate the remaining days until the events, first add the **"dateDif"** function to the formula, which you can find in the Formula Editor under the *Date Functions* tab.

In order for the formula to calculate the duration of each vacation, you must reference the **columns** where the **arrival and departure dates** are collected in your table.

It is especially important that the column names are surrounded by **curly brackets**, otherwise SeaTable **cannot** recognize which period should be calculated using the formula.

**column names of**the table you selected are displayed in the

**formula editor**under the Columns tab and can be added to the formula with a

**double-click**.

Finally, add to the formula the **calculation methodology** that will determine in which **format** the duration of your vacations will be displayed to you afterwards. If you want the remaining time to be calculated in **days**, add **"D"** (days) to the end of the formula.

Before confirming, it is important to note that the **parenthesis** must be **closed** for the formula to be accepted as valid.

After confirming the entered formula, the duration of each vacation will be **calculated** and automatically added to the **formula column of** your table.