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. revenue reads Revenue.
  • When one name starts another, Eigenn reads the longest name that matches. Total revenue reads Total revenue, not Revenue.
  • A variable from a linked model uses the form Model.Variable, such as Headcount Plan.Payroll.
  • Built-in helper names, such as month, year, and e, are reserved. A variable named Month reads as the month helper. A name that starts with a helper as a whole word, such as Year 1 revenue, gives an error. Rename the variable, for example to First-year revenue.

Numbers and text

WriteValue
15001,500
0.250.25
15%0.15
-40−40
  • Do not type thousands separators. 1,500 gives an error, because the comma separates arguments.
  • Write a zero before the decimal point. .5 gives an error. Write 0.5.
  • Put text in quotes only where a function accepts text, such as currency(Revenue, "EUR") or error("Enter a start date").

Operators

OperatorMeaningExampleResult
+Add2 + 35
-Subtract, or make negative10 - 46
*Multiply15% * 20030
/Divide9 / 33
%Remainder after division10 % 31
^Power2 ^ 38

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 as sum([10, 20, 30]).
  • 80 to 120 is 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:

  1. Parentheses ( )
  2. A leading minus, such as -x
  3. Power ^, from right to left
  4. *, /, and %, from left to right
  5. + and -, from left to right
  6. Comparisons, in, and to
  7. not
  8. and
  9. or
  10. if ... then ... else
FormulaResultReason
2 + 3 * 414Multiplication comes before addition
(2 + 3) * 420Parentheses come first
2 ^ 3 ^ 2512Power works from right to left
-2 ^ 24The leading minus comes before the power
if 1 = 0 then 2 else 3 + 14+ 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) / Revenue

Keywords and function names are not case-sensitive. IF, If, and if are the same.