You can create custom functions using regular formulas inside a document, then use your custom functions throughout the document.
Define the function
It's easy to define a function. In a formula, type this basic layout:
FunctionName(param1, param2, etc) = Equation using parameters
Use the function
To use the function, treat it like a normal built-in function. Type the name and put a parentheses at the end with the inputs.
Functions are treated a lot like values, so they are highlighted when used, and you can click it to use it in a formula (like a spreadsheet cell).
Use functions in spreadsheets
Functions are great for working with spreadsheets and tables. You can define the equation once, and then use it for an entire column.
Turn ordinary formulas into functions
If there's a formula that's used multiple times, it's easy to transform it into a function. Add the parentheses and parameters after the name and then replace the actual values with the parameter names.