Comparing text strings using IF statements in Airtable
  • 28 Mar 2024
  • 1 Minuto para leer
  • Oscuro
    Ligero
  • PDF

Comparing text strings using IF statements in Airtable

  • Oscuro
    Ligero
  • PDF

The content is currently unavailable in Spanish. You are viewing the default English version.
Resumen del artículo

Plan availability

All plan types

Platform(s)

Web/Browser, Mac app, and Windows app

Related reading

This article covers how to compare text strings using the IF() function in Airtable to streamline your team's and organization's work.

IF statements in Airtable overview

IF functions or conditional statements return one of two values depending on whether a logical argument is true or not. IF statements in Airtable are written in the following format:

IF([logical argument], [value1],  [value2]) 

NOTE

This function means "If [logical argument is true], then return [value1]. Otherwise, return [value2]." The logical argument can either be text or a numeric value, e.g. {Pet's Name}='Rufus' or {Test Score}>75. The return value options can be text, numeric values, or use field names.

Using IF statements in Airtable

NOTE

IF statements work well for many cases, but we recommend trying the SWITCH function.

As an example, let's say that you want to track a few projects that are in progress, and output a different message based on the status of the project. Each project can have a status of Not started, In Progress, or Complete.

Here's what you may want to output in another field based on the status:

  • Not started: ❌

  • In Progress: ❌

  • Complete: ✅

The formula below will output a different emoji character based on the text value in the Status field.

IF({Status}='Complete','✅','❌') 
360055124994ScreenShot2020-01-14at10810PM.jpg

For another example, a small business may want to generate different messages to push to their website regarding inventory status. Items that are in stock should display one message, while items out of stock should alert the customer so they can be put on a waitlist.

Using the same formula structure, we can conditionally output a different message based on inventory status.

IF(
  {Inventory}='In stock',
    "Item is in stock and available for purchase",
    "ℹ️ This item is on backorder, but will be back in stock soon"
)
360056003573Inventory.jpg


¿Te ha sido útil este artículo?