As you start building out your docs, you may find that you want to use one of your handy formulas in multiple places. Rather than having to copy/paste, or remember your work, you can name a formula and use it like a doc variable. You can then reference this named formula throughout your doc, anywhere you write formulas.
Within this article, you’ll find...
Create a named formula
To create a named formula, you need to start in the canvas. Once created, you can reference this formula (and therefore its value) anywhere you write formulas.
Follow the steps below to add a new named formula:
On any blank line on the canvas (including within a canvas column), type = to open the formula builder
Type the desired formula into the formula builder. Check out Basics of Coda formulas for more info on creating formulas.
Click into the Add name section, and type the name. You’ll later use this name to reference this formula elsewhere.
Optionally, you can specify the format (date, text, number, etc.) of the value outputted by your named formula. To do so, navigate to the right-hand side of the formula builder, and look for the symbols that indicate the format type (right next to the expand arrows). Click on this symbol, and select the desired format.
Reference a named formula
Now that your formula has a name you can reference it anywhere inside your doc that you can write a formula. Simply type the name of the formula into the formula builder and select it from the options. You can then combine this named formula with Coda formulas as needed.
And if you need to update your formula, not to worry - those changes will be populated anywhere you used that named formula.
Find named formulas in the doc map
If you ever lose track of your named formula, you can track it down by accessing the doc map. To do so:
Click on the settings wheel in the upper right corner of your doc
Choose Doc map from the list
In the Other options section, click on Formulas to expand the list of named formulas.
Find and click the desired formula from this list. This will jump you to the location of that named formula.
FAQs
How do I change the name of a named formula?
How do I change the name of a named formula?
Simply find the named formula in the canvas and right-click to open the formula editor. Click into the field where the name is displayed, and edit the name as needed. Hit Enter on your keyboard - or click out - to save the changes.
Can I create a named formula elsewhere besides the canvas?
Can I create a named formula elsewhere besides the canvas?
You can only create new named formulas via canvas formulas, either in the main canvas of the doc or in a canvas column. But once they are created, you can reference the named formulas throughout your doc, anywhere that you would write a formula.
Can I specify the format of a named formula?
Can I specify the format of a named formula?
Yes - you can either let Coda auto-detect the format of the formula output, or you can specify the format yourself. To do so, right-click on the formula to open the editor. Then, to the right of the previewed value, click on the symbol that indicates the format. You can then choose the format type from the options.