Comment on page

# Creating formulas

Formulas let you work with numbers, ranges, and other variables. Here are some examples:
• `25` : constant value of 25
• `1 to 5` : range from 1 to 5 (technical detail: symmetric triangle distribution)
• `(0 to 1) * MyVariable` : the product of a range and another variable
• `if VariableA > 10 then 1 else 0`: self explanatory. You can link multiple conditions with `and` and/or `or`. See if statements for more!
• `sample(3, 5)`: either the value 3 or the value 5 (discrete distribution)
You can create formulas in the Formula column (for all timesteps of a variable) or set a different formula/value for a particular timestep in the timestep columns (read more here). ### The Basics

• The syntax for basic operations is the same as Excel: `+ - * / ^ > < =`
• Not equal to is either `<>` or `!=`
• You can reference variables in formulas by typing the variable name and selecting it from the autocomplete dropdown. You can also reference variables in other models if they're linked. • You can add comments to your formulas with a double slash `//` Everything between the double slash and the end of the line will be ignored by Causal when calculating. This is useful when you want to remind yourself (or others) what the formula is doing. 