Skip to main content

Nested IF for three options

  • July 27, 2023
  • 11 replies
  • 67 views

Dgmknzgrl
Forum|alt.badge.img+7

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)'

 

 
This is the least complicated of all the attempts made which seems to work, but I can't figure out how to get the brackets to behave.
IF({Full Name}=TRUE(),{Full Name},(IF({Full Name}=FALSE(),{Organization Name},{Full Name}&" ("&{Organization Name})))&")"
 
And a screenshot of what it looks like. The only one that is correct it the Name (Organization).
 
 
Thanks in advance!

11 replies

TheTimeSavingCo
Forum|alt.badge.img+31

Try this:

IF( AND( {Full Name}, Organization ), {Full Name} & " (" & Organization & ")", IF( {Full Name}, {Full Name}, Organization ) )

Resulting in this:


Alexey_Gusev
Forum|alt.badge.img+25
IF(Organization, IF({Full Name}, {Full Name}&' ('&Organization&')', Organization), {Full Name})

Dgmknzgrl
Forum|alt.badge.img+7
  • Author
  • Participating Frequently
  • July 28, 2023

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...?

  

 


Alexey_Gusev
Forum|alt.badge.img+25

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...?

  

 


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})

 

 

Dgmknzgrl
Forum|alt.badge.img+7
  • Author
  • Participating Frequently
  • July 28, 2023

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})

 

 

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....


Alexey_Gusev
Forum|alt.badge.img+25

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....


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   😀

 


Dgmknzgrl
Forum|alt.badge.img+7
  • Author
  • Participating Frequently
  • July 31, 2023

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   😀

 


@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.   

 

 

 


pressGO_design
Forum|alt.badge.img+21

Try this:

IF(AND({Full Name}, Organization), {Full Name}&" ("&Organization&")", {Full Name}&Organization)


Dgmknzgrl
Forum|alt.badge.img+7
  • Author
  • Participating Frequently
  • July 31, 2023

Try this:

IF(AND({Full Name}, Organization), {Full Name}&" ("&Organization&")", {Full Name}&Organization)


Still getting the same result for some reason. 

 


pressGO_design
Forum|alt.badge.img+21

Is it possible that there are spaces in your Full Name field? Because that is one thing that would cause that behavior.....


Dgmknzgrl
Forum|alt.badge.img+7
  • Author
  • Participating Frequently
  • August 2, 2023

Is it possible that there are spaces in your Full Name field? Because that is one thing that would cause that behavior.....


Yes! My Full Name field is a formula and was generating a space. Thanks much!!