Jul 27, 2023 03:57 PM
I've spent a fair bit of time looking and IF, AND, OR, SWITCH formulas but can't seem to figure this out for making three different options using two fields with the correct punctuation.
I have two fields, {Full Name} and {Organization}.
If there is just a name, I want 'Full Name'
If there is just an organization, I want 'Organization'
If there is both a name and organization, I want 'Full Name (Organization)'
Jul 27, 2023 09:24 PM
Try this:
IF(
AND(
{Full Name},
Organization
),
{Full Name} & " (" & Organization & ")",
IF(
{Full Name},
{Full Name},
Organization
)
)
Resulting in this:
Jul 28, 2023 12:49 AM
IF(Organization,
IF({Full Name},
{Full Name}&' ('&Organization&')',
Organization),
{Full Name})
Jul 28, 2023 09:36 AM
Hi all, thanks for the help.
For both of those formulas, I'm getting brackets around both 'organization' and 'full name (organization', and an error that says missing opening parenthesis...?
Jul 28, 2023 11:55 AM
That's because your field name is {Organization Name}, not Organization. (if field name contains space, it must be in brackets). I suppose you put wrong name in description, but your formula contains correct name.
So,
IF({Organization Name},
IF({Full Name},
{Full Name}&' ('&{Organization Name}&')',
{Organization Name}),
{Full Name})
Jul 28, 2023 12:27 PM
Hmmm, I changed the fields to be Organization Name and Full Name to match your example and copy/pasted your formula but I'm getting the same errors for some reason....
Jul 28, 2023 04:26 PM
I have the same warnings, but when I press Save, it's ok, and it works good.
On different projects I'm using complex and composed formulas and ... in short, linter often lies 🙂
So I just ignore these warnings if formula works as expected. Did you try to just press Save? If something really wrong with syntax, it won't let you 😀
Jul 31, 2023 07:29 AM
@Alexey_Gusev it accepts the formula for sure. And the formula works for Name (Organization) and Full Name, but I'm still getting ( ) around my Organization when it is the only item.
Jul 31, 2023 08:37 AM
Try this:
IF(AND({Full Name}, Organization), {Full Name}&" ("&Organization&")", {Full Name}&Organization)
Jul 31, 2023 09:10 AM
Still getting the same result for some reason.