Kuovonne's Guide to Airtable
Share
Explore
Kuovonne's Guide to Airtable
Writing Formulas

General tips for writing formulas

Thank Kuovonne for creating this content!
Here some tips for writing formulas:
Understand the data type that each field type uses for formulas: text, number, date, array. Note that the data type for a field varies depending on context. Single-selects are treated as text in formulas, but are objects in scripting. There are hints as to data type by looking at a cell value (text is left aligned and numbers are right aligned), but you cannot tell the difference between some data types just by looking at cell values. Also, learn how to convert from one data type to another.
Read the and refer back to it when you have a question about a particular function. This is the vocabulary of formulas, and the more vocabulary that you have memorized, the easier it is to find the right words to say what you want. Know the data type of each input parameter and the data type of the output.
Understand the grammar of formulas. No space between a function name and its open parenthesis. Commas between parameters.No trailing comma after the last parameter. The importance of straight quotes around hardcoded text.
Understand how to nest one formula inside another. Knowing data types (of both inputs and outputs) and where to put the commas is essential for this. Use a multi-line style of writing formulas to make nesting clear.
Understand “truthy” and “falsy” values for IF() conditions. The number zero, empty strings, BLANK(), FALSE(), ERROR() are all falsy.
Know if you are working with an array or not. Often lookups are arrays. Arrays often behave in unexpected ways in formulas.
There usually are multiple ways to do things in code, but some ways are better than others. Features of a good formula include producing correct results, being easy to understand, and avoiding excessive calculations.
Even though formulas are code, there is no explicit support for comments or for assigning values to variables.
Keep writing formulas. The more you do it, the easier it gets.
Test your formulas as much as possible. Test typical cases. Test edge cases. Test blank values. Test error conditions.
Work to understand every word and piece of punctuation in a formula.
Thank Kuovonne for creating this content!

Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.