# Creating formulas

Formulas let you work with numbers, ranges, and other variables. Here are some examples:

`25`

: constant value of 25`(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 in the timestep columns (read more here).

- 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.

- Click on
**Show Formulas**in the top-left of the spreadsheet to see all the formulas in your model

Last modified 3mo ago