Basic formulas and calculations
Overview
The operators specify what types of actions are performed on arguments (operands) in the formula. The Inline Table Editing macro supports the operators that are common in spreadsheet software. They are calculated in a specific order, which can be altered by parentheses.
Currently, it supports the following operators:
Unary operators
Binary arithmetic operators
Comparison operators
Concatenation operator
Reference operators
Unary operators
The unary operators have only one argument (operand). For example, when a number is passed to the unary negation operation, it returns the negative value of that number.
Operator | Meaning | Example | Description |
---|---|---|---|
- | Unary minus | -a | Returns the negative of its argument. |
+ | Unary plus | +a | Returns the positive of its argument. |
% | Percent | a% | Calculates the percent of an argument. |
Binary arithmetic operators
The binary arithmetic operators enable the computation of basic mathematical operations. They don't have to be wrapped with any functions. This table shows the basic behavior of the binary arithmetic operators:
Operator | Meaning | Example | Description |
---|---|---|---|
+ | Addition | a + b | Add the two arguments. |
- | Subtraction | a - b | Subtract the second argument from the first argument. |
* | Multiplication | a * b | Multiply the two arguments. |
/ | Division | a / b | Divide the first argument by the second argument. |
^ | Exponentiation | a ^ b | Raise the first argument by the power of the second argument. |
Comparison operators
When used in a formula, the binary relational operators return Boolean or logical values. Here are some very general rules:
Operator | Meaning | Example | Description |
---|---|---|---|
= | Equal to | a = b | True if a is equal to b. |
< | Less than | a < b | True if a is less than b. |
> | Greater than | a > b | True if a is greater than b. |
<= | Less than or equal | a <= b | True if a is less than or equal to b. |
>= | Greater than or equal | a >= b | True if a is greater than or equal to b. |
<> | Not equal to | a <> b | True if a is not equal to b. |
Concatenation operator
The concatenation operator is used to combine multiple text strings into a single value.
Operator | Meaning | Example | Description |
---|---|---|---|
& | Concatenation | "a" & "b" | Concatenates two arguments (left and right) into one |
Reference operators
The reference operators are used to perform calculations of combined ranges.
Operator | Meaning | Example | Description |
---|---|---|---|
: (colon) | Range operator | A1:B1 | Makes one reference to multiple cells between the two specified references. |
, (comma) | Union operator | A1:B1,A2:B2 | Returns the intersection of multiple ranges. |
(space) | Intersection operator | A1:B1 A2:B2 | Finds the intersection of the two ranges. |
Working with decimals
If you want to work with decimals and do some calculations using formulas, please use a comma as a delimeter. For example, 3 and a half would be written as 3.5, and 2 and a quarter would be 2.25.