How to use Formulas in your RowShare tables?
RowShare calculated columns are formulas based on the value of the other cells of the same row. Add a "Calculated value" column and specify the formula in this column’s settings. Yes, this means that the formula will always be the same in a given column.
Start by adding a new column to your table, and click "Automatic" and “Calculated Value”. Give a name to your column, and scroll to the bottom to enter the formula:
Calculated values can include 4 types of content:
References to other columns
A column is referenced by its name, surrounded by squared brackets [ ]. Examples:
- [Customer Name]
These values are typically numbers or text. Text must be surrounded by double quotes. Examples:
- 4 standard mathematic operations: +, -, *, /
- Comparison operators: >, <, >=, <=, =, !=, <> (the last two ones are equivalent and mean "not-equal")
RowShare offers additional functions to manipulate numbers, text, dates and introduce logical operations.
- min(n1, n2, n3...) : returns the smallest number
- max(n1, n2, n3...) : returns the largest number
- sum(n1, n2, n3...) : returns... the sum!
- avg(n1, n2, n3...) : returns the average
- rand() : returns a random numeric value between 0 and 1
- abs(number) : returns 1 for positive numbers and -1 for negative numbers
- floor(number) : Returns the largest integral value less than or equal to the specified number
- ceiling(number) : Returns the smallest integral value greater than or equal to the specified number
- round(number) : Rounds a number to the nearest integer number
- truncate(number): returns the integral part of a number.
- datediff(leftDate, rightDate) : returns the number of days between 2 dates
- now() : returns the current date and hour, based on the current user timezone as set in his account.
- utcnow() : returns the current UTC date and hour.
The following functions take a date as parameter and return the corresponding year/month/day/hour...
- lower(string) : converts a string to lowercase
- upper(string) : converts a string to uppercase
- IF(condition, ifTrue, ifFalse) takes 3 parameters: 1st is the condition, 2nd is the result if the condition is met, the 3rd is the result otherwise.
IF(COL1 > 0, 1 , -1). You could also have used Abs(COL1) to get the same result.
- ISNULL(column, defaultvalue) takes 2 parameters: if the first one is NULL (empty cell), it will return the second parameter. If the first one is not null, it will be returned.
ISNULL([First Name],"") + " " + [Last Name]
- ISNULL(column) takes 1 parameter and returns true if the cell in that column is empty and false if it's not empty.
· Numbers: To calculate the sum of two columns Total Priceand VAT, the formula is:
= [Total Price] + [VAT]
· Text: To combine the columns First Name and Last nametogether, the formula is:
[First name] + [Last name]
Of course, it would look better with a space between first name and last name. Add it between double quotes:
[First name] + " " + [Last name]
- Calculated values can not reference other calculated values.
- Calculated values do not function if referenced column names include one of the following characters:
- You can show calculated field as percentage: go to the column settings by clicking on the settings button on the header of that column, change your column type to “Advanced”, set the data type to “Number”, and you will find “Percentage” box, set it as “Yes”.