All Collections
Formulas
General formula info
Troubleshooting your formulas
Troubleshooting your formulas

Best practices for diagnosing formula issues

Updated over a week ago

Inside this article:


If your formula ever gives you an unexpected result or error, there are a few best practices for troubleshooting.

Best practices:

1. Give every ingredient a unique name

Since you'll use the actual names of items in your formulas, it will be a lot easier if everything has a unique name. Coda helps you out by color-coding items that come from the same table, but this will eliminate any confusion

Instead of:
​

both the table and the column are titled "Project" πŸ™…

Use this:

2. Know your references and strings

Oftentimes, formulas don't produce expected results because you're comparing strings against references.

  • References are links to tables, columns, rows, or even people and therefore have all sorts of their own metadata

  • Strings are a set of characters, like the status of a task, or the cost of an item on your grocery list. It's a fancy word for plain text.

Comparing strings to references is like apples and oranges. While they might seem similar at first glance, they're actually entirely different types of data and cannot be directly compared.

Usually, when you're trying to compare a string with a reference, what you actually mean to be doing is comparing the string with a single column within that reference. Try being more specific with your formula and state which column to compare the string against.


​


Troubleshooting:

1. Check the result

As you write your formula, Coda will populate the result so you can check your work before committing:

2. Check the icons & match the data

Issues often arise when trying to compare one data type, like text, against another data type, like a number. Similarly, you might run into problems if you're comparing a list against a single value, regardless of the data type.
​

Each input will also have an icon letting you know what type of data you're working with. So you can use these icons to make sure that you're pulling the right element (e.g. column, table, row, etc.) and the right type of data (text, number, row, etc.). Notice in the table below that if there's only one of those objects, the icon will look different than if there are multiples of that item.


​

You can find these icons in the headers for each column and within the various components of a formula. And you can click on any chip in a formula to see explicitly what that component consists of:
​

For more info on data types and avoiding type mismatch issues, check out this webinar.

3. Check the colors

When you're working in Coda, elements that come from the same table have the same color so if you're anticipating working from two places make sure that the colors are different:

4. Test each step

When all else fails, start creating your formula piece by piece. You'll then be able to ensure that each step functions as expected.

Learn by Watching

Check out this great Coda Tip from our very own Maria Marquis!


Related articles:

Did this answer your question?