IF functions (sometimes known as “IF statements”) may sound a bit frightening, but they're actually one of the most commonly used functions in databases and spreadsheets. In a formula, they let you compare inputs and take one action if the result is true, or another action if the result is false.
The idea of “if” comes up in all kinds of logical choices. For example: “If I follow the yellow brick road, I’ll get to see the Wizard of Oz.” If an input is true, you follow the yellow road and see the wizard. If the input is false and you choose not to follow the road, you don’t see the wizard at all.
Here’s another example: say you’re in the middle of several large marketing campaigns. You’d like to know which of them have budgets over $50,000 and which are under. Applying an IF function can give you that insight, showing which inputs meet the $50,000 threshold and which do not.
In Airtable, an IF function lets you compare:
- text strings
- text fields
- numeric fields
- or any other field
To use an IF function in Airtable, you’ll need to create a new field. You can do so by scrolling to the right of your base in any grid view and clicking the "+" icon. Give it a descriptive name, then choose the field type “Formula.”
This calls up a box where you can write your formula.
Let’s say you want to check on the status of various tasks you’re managing. To run a formula that shows what’s completed vs what’s in progress, the IF function will look like this:
But then you want to run an even more complex test.
Sticking with our status check example, perhaps you want to know: among the projects in progress, which are more than 50% complete? You can display the answer using a nested IF, which you’ll also type into the formula box. A nested IF lets you add more parameters to check.
At the end of any project, an IF function is a great way to track how successful the project was. How many packages arrived late? Or weighed in at more than 50 pounds? Because you can compare dates, text, or numbers, the IF function can help you calculate it all.