Calculated Field IfElse and Contains

Hello,

I am just learning how to use calculated fields and I am looking to create a field for contacts.

I want it to look at the contacts title and if it contains finance I want the field to show a F also if the the title shows operations I want it to show O. If it has neither I want it to be blank.

I have been trying to use the IfElse formula with the contains formula I have got this so far.

ifElse(contains("$title","Fin"),"F","")

This does not return any value and I have not figured out how to add another variable like the operations part.

Any help would be appreciated.

Thanks!

  • Hi  ,

    When using fields as a reference in the formula, you should not have any quotes around the field name. To achieve you complete use case, you need to use the 'else' parameter to nest another ifElse statement for your next evaluation. The formula should look like the following:

    ifElse(
        contains(
            $title,
            "Fin"
        ),
        "F",
        ifElse(
            contains(
                $title,
                "Operations"
            ),
            "O",
            ""
        )
    )

    The above formula is assuming the contact's title would never have both 'Fin' and 'Operations'. If that is a possible scenario, then you would do the following formula:

    ifElse(
        and(
            contains(
                $title,
                "Fin"
            ),
            contains(
                $title,
                "Operations"
            )
        ),
        "FO",
        ifElse(
            contains(
                $title,
                "Fin"
            ),
            "F",
            ifElse(
                contains(
                    $title,
                    "Operations"
                ),
                "O",
                ""
            )
        )
    )

    Chris