The Formulas plugin allows Handsontable to process formula expressions defined in the provided data. This plugin uses a formula-parser library which takes most of functions from formula.js.
- Any numbers, negative and positive as float or integer;
- Arithmetic operations such as:
- Logical operations such as:
- Comparison operations such as:
- Error handling:
- String operations such as:
- All excel formulas defined in formula.js;
- Relative and absolute cell references such as:
- Build-in variables such as:
- Custom variables;
- Nested functions;
- Dynamic updates.
- Not working with filtering and column sorting;
- Not working with trimming rows.
To enable the plugin you need to set the
formulas property to
true. Cells that are dependent on the edited value will be dynamically recalculated.
You can pass your custom variables which can be ready to use in your formula expressions. To set custom variables pass
an object with key:value pairs to the
Updating custom variables
At some point, you may want to update the custom variable's value. To do so, you need to use both
setVariable and one of
The advanced example shows how to manage nested formulas. Also you can see how to set dependencies between different types of formulas.