Formula syntax
The rules for names, numbers, text, operators, comments, and the order of operations in a planning formula.
A planning formula is one expression. It has no = at the start and no cell addresses. You name variables, write numbers, and join them with operators and functions. Use this page when you need the exact rules.
Variable names
- Write the name as the grid shows it. A name can contain spaces and commas, such as
Operating expenses. - Upper case and lower case do not change the result.
revenuereads Revenue. - When one name starts another, Eigenn reads the longest name that matches.
Total revenuereads Total revenue, not Revenue. - A variable from a linked model uses the form
Model.Variable, such asHeadcount Plan.Payroll. - Built-in helper names, such as
month,year, ande, are reserved. A variable namedMonthreads as themonthhelper. A name that starts with a helper as a whole word, such asYear 1 revenue, gives an error. Rename the variable, for example toFirst-year revenue.
Numbers and text
| Write | Value |
|---|---|
1500 | 1,500 |
0.25 | 0.25 |
15% | 0.15 |
-40 | −40 |
- Do not type thousands separators.
1,500gives an error, because the comma separates arguments. - Write a zero before the decimal point.
.5gives an error. Write0.5. - Put text in quotes only where a function accepts text, such as
currency(Revenue, "EUR")orerror("Enter a start date").
Operators
| Operator | Meaning | Example | Result |
|---|---|---|---|
+ | Add | 2 + 3 | 5 |
- | Subtract, or make negative | 10 - 4 | 6 |
* | Multiply | 15% * 200 | 30 |
/ | Divide | 9 / 3 | 3 |
% | Remainder after division | 10 % 3 | 1 |
^ | Power | 2 ^ 3 | 8 |
A % directly after a number makes a percent, such as 15%. For the remainder, put a space before the %, such as 10 % 3. A division by zero gives Invalid number error.
To compare values, use =, <>, <, <=, >, and >=. != has the same meaning as <>. A comparison gives 1 for true and 0 for false. The Conditionals page explains if, and, or, not, and in.
Lists and ranges
[10, 20, 30]is a list of values. Use it as a function argument, such assum([10, 20, 30]).80 to 120is an uncertain value between two limits. The Uncertainty page explains it.- Square brackets after a function call select one value from its result.
finance.DF(10, 3)[1]reads the value at position 1. - Square brackets after a variable name are a time reference, such as
Revenue[previous]. The Time references page explains them.
Order of operations
Eigenn applies the operations in this order, from first to last:
- Parentheses
( ) - A leading minus, such as
-x - Power
^, from right to left *,/, and%, from left to right+and-, from left to right- Comparisons,
in, andto notandorif ... then ... else
| Formula | Result | Reason |
|---|---|---|
2 + 3 * 4 | 14 | Multiplication comes before addition |
(2 + 3) * 4 | 20 | Parentheses come first |
2 ^ 3 ^ 2 | 512 | Power works from right to left |
-2 ^ 2 | 4 | The leading minus comes before the power |
if 1 = 0 then 2 else 3 + 1 | 4 | + 1 is part of the else result |
You cannot chain comparisons. 3 > 2 > 1 gives an error. Use and to join two comparisons.
Spaces, lines, and comments
Spaces and line breaks do not change the result. Press Shift+Enter in the formula bar to start a new line.
Put a note after //. Eigenn ignores the text from // to the end of the line.
// Gross margin before shared costs
(Revenue - COGS) / RevenueKeywords and function names are not case-sensitive. IF, If, and if are the same.