Since RSpace 1.47 you can add a special table element that supports Excel-like formulas. This allows for doing basic mathematical calculations on tabular data inside text fields.
To insert a Calculations Table you must be in edit mode in a document text field. Click in the text field to create an insertion point for your file. Go to the editor toolbar above the text field, and find the ‘Insert Calculations Table’ button. This will open a window like the one in the screenshot below.
Inside the ‘Calculations Table’ dialog you can edit the content of the table and also add/remove columns and rows (try right-click menu). When editing a table cell you can insert a plain value, or a formula. The formula has to start with an equals sign (=) and will be calculated after switching to another cell. Inside the formula you can reference another cell with $A1 or A1 syntax, similarly to Excel.
When you finish editing the table click on ‘Insert’, and the table will be added to the text field. When the calculation table is added to the field it is treated as any other field element, and can be moved around or deleted. Double-click on the table (or use context menu action) to re-open it for editing.
The list of supported operations includes:
- math functions:
- logical functions:
- trigonometric functions: SIN, ASIN, etc.
- other formulas like: SUM, SQRT, LOG, ROUND, IF, AND, OR
Examples of more complex formulas:
- =SUM(A1:C1) -> add values from cells A1, B1, C1
- =ROUND(B1/C1, 2) -> divide value of B1 and C1 cell, round to two decimal places
- =SUMIF(A1:C1, ‘>1’) -> add these of A1, B1, C1 values that are larger than 1
The full list of available formulas is available here.
Write an expression in the cell where you want the answer to go, then write the input values in the cells you specified in your expression, then hit return. Once you have created the expression you can put whatever input values you like in the input cells to perform your calculation over and over again with different input values.
Examples: For multiplication type =A1*B1 in a cell (eg C1). Add values into cells A1 and B1 and hit “return” to see the result in C1. Note that you can now change the values in A1 and B1 to anything you like to find the product of any two numbers.
For division type =A2/B2 in a cell (eg C2) then add values into cells A2 and B2 to get a result.
For addition type =A3+B3 in a cell (eg C3) then add values into cells A3 and B3 to get a result.
You can make it more obvious what your calculations do by adding text in some of the fields like this: