Help

Welcome to the Airtable Community! If you're new here, check out our Getting Started area to get the most out of your community experience.

SWITCH formula If

Solved
Jump to Solution
466 2
cancel
Showing results for 
Search instead for 
Did you mean: 

I’m trying to create a SWITCH formula checking for specific text within a field.
For instance, if there is a field with a bunch of random numbers and then a name, I want to check for the name in that field, not match the entirety of the text in the field.

1 Solution

Accepted Solutions

Assuming that there’s nothing after the person’s name that needs to be omitted/ignored, this formula that uses a regular expression to extract only the name will work:

IF(
    Source,
    SWITCH(
        REGEX_EXTRACT(Source, "[^\\d]*$"),
        "Bob", "Bob's output",
        "Jake", "Jake's output",
        "Arnold", "Arnold's output"
    )
)

Screen Shot 2021-12-28 at 2.01.28 PM

If the source material is more complex, could you share a sample?

See Solution in Thread

2 Replies 2

Assuming that there’s nothing after the person’s name that needs to be omitted/ignored, this formula that uses a regular expression to extract only the name will work:

IF(
    Source,
    SWITCH(
        REGEX_EXTRACT(Source, "[^\\d]*$"),
        "Bob", "Bob's output",
        "Jake", "Jake's output",
        "Arnold", "Arnold's output"
    )
)

Screen Shot 2021-12-28 at 2.01.28 PM

If the source material is more complex, could you share a sample?

Worked great. Thank you.