Help

Formula Help - If/Then Concatenate?

6872 22
cancel
Showing results for 
Search instead for 
Did you mean: 
Chris_Livingsto
4 - Data Explorer
4 - Data Explorer

I have one field that I would like to generate from three other ones. First Name, Last Name and Company

If there is a first and last name in the directory I would like to display it as the following:

Last Name, First Name

If there is no person’s name then I would like it to only display the name of the company. I just don’t know how to remove the space and comma. Currently using this:

CONCATENATE({Last Name}, ", “, {First Name},” ",Company)

I’m thinking I need some sort of IF/THEN statement??

Thanks!

22 Replies 22
IF(AND({First Name} != BLANK(), {Last Name} != BLANK()), CONCATENATE({Last Name}, “, “, {First Name},” “,Company), Company)

Try that

Chris_Livingsto
4 - Data Explorer
4 - Data Explorer

Darn. No luck. Invalid Formula error. Thanks for taking a stab at it though!

IF(AND({First Name}!=BLANK(),{Last Name}!=BLANK()),CONCATENATE({Last Name},", ",{First Name}," ",Company),Company)

Sorry - I think somewhere in the copy-paste process the wrong character got put in for the "s. That one should work, and if it doesn’t, manually delete the "s and replace them with your keystroke for that character.

Hi Jeremy,

Tha formula actually doesn’t report an error “invalid formula” like the first one you posted, so technically it works, but it still leaves a space and comma before the company name when there isn’t first and last name.
Capture.JPG
You are so close!!! I just want the names to line up flush in the column justified to the left. Thanks a bunch for your help!

IF(AND({First Name},{Last Name}),{Last Name} & ", " & {First Name} & " ",BLANK()) & Company

That did it! You are the man!! Thanks so much

Amy_Ball
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello @Jeremy_Oglesby,

I was wondering if you could help me with a similar issue. I have the following four columns:

Mtg Code
Attendee 1
A1 Mtg ID
A1 Mtg Code

I’d like to populate A1 Mtg Code with a concatenate of Mtg Code and A1 Mtg ID but only if Attendee 1 contains text. I know how to concatenate, and I know how to use IF statements, but I can’t quite figure out how to use them together.

I’ve tried several variations of your formula here with no luck. I’m sure I’m overlooking the obvious. Would you have any suggestions?

Thanks so much!

Amy

What do you want it to contain if {Attendee 1} does not contain text?

This formula will fill {A1 Mtg Code} with “Mtg Code - A1 Mtg ID” if there is anything in {Attendee 1}, otherwise it will leave {A1 Mtg Code} blank:

IF(
   {Attendee 1},
   {Mtg Code} & " - " & {A1 Mtg ID},
)

This is exactly what I needed. Thank you so much!!!

Amy_Ball
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi Jeremy,

Thanks again for your help yesterday.

If I might trouble you further, is there a formula that can populate one field by searching the text contained in another field for a specific value within that text?

I have a field that contains a list of equipment that is separated by commas. I’d like to create separate fields for each type of equipment and then populate those columns automatically via a formula if specific text appears somewhere in the equipment field. For example:

Fields:
All Equipment (Text field)
Projector (Formula)
Screen (Formula)
Lectern (Formula)

Example Record A:
All Equipment: Projector, Screen
Projector: 1
Screen: 1
Lectern: Blank

Example Record B:
All Equipment: Projector, Screen, Lectern
Projector: 1
Screen: 1
Lectern: 1

Example Record C:
All Equipment: Blank
Projector: Blank
Screen: Blank
Lectern: Blank

Hopefully that makes sense.

Thank you!

Amy

Yes, this should be possible. In your examples, you only ever have 1 instance of a type of equipment – will that always be the case? Will something like this ever be needed:

Example Record 😧
All Equipment: Projector, Projector, Screen, Screen
Projector: 2
Screen: 2
Lectern: Blank

I’m not certain that the above is possible, at least not in an easy/straight-forward fashion…

But if all you need is to recognize the presence of any number of “Projectors” or any number of “Screens”, etc, in the “All Equipment” field, then this simple formula should do it:

In the “Projector” formula field:

IF(
   FIND(
      "Projector",
      {All Equipment}&""
   ),
   1
)

But again, that will return “1” even if there are 4 instances of the word “Projector” in the “All Equipment” field.

Thanks, Jeremy! This, again, is exactly what I needed as I’ll only ever have one of each type of equipment.

Have a great day!

John_Dlouhy
7 - App Architect
7 - App Architect

Hello Jeremy!

I am hoping you can help with a formula. I am building a base to track event attendees. The table includes a “First” field to list the first names. Every record in this table will have data in the “First” field. Another field is called “With First” and will only have data when someone brings a guest. I need a “Salutation” formula field that would yield the following results:

If “With First” is blank, enter the information from the “First” field.
Example: James is coming alone, therefore the “Salutation” field would simply be James.

If “With First” is NOT blank, enter the information from the “First” field, add " and ", add information from “With First” field. Example: James is bringing Sally, therefore the “Salutation” field would be “James and Sally.”

I’m relatively new to Airtable and am learning quickly–but anything beyond basic formulas is posing a challenge!

With best regards,

John

{First} &
IF(
   {With First},
   " and " & {With First}
)
John_Dlouhy
7 - App Architect
7 - App Architect

G E N I U S !!! Thanks so much Jeremy!! Incredible help.

Lisa_Nelson
5 - Automation Enthusiast
5 - Automation Enthusiast

@Jeremy_Oglesby Thank you! Your answers to these other questions helped me write my formula.

I wanted to return results that had Job # - Company, unless there was no Company. In that case, I wanted Job # - Contact Last. In the event that there was no Job #, I wanted to have Proposal # - Company, unless there was no Company, then I wanted Proposal # - Contact Last. In the event there is no Job # or Proposal #, I wanted Company or Contact Last if there was no Company.

My head was spinning! Your examples helped we write the following formula that does just what I needed!

IF(AND(Company,{Job #}),{Job #}&" - "&Company,

IF(AND({Contact Last},{Job #}),{Job #}&" - "&{Contact Last},

IF(AND(Company,{Proposal No}),{Proposal No}&" - "&Company,

IF(AND({Contact Last},{Proposal No}),{Proposal No}&" - "&{Contact Last},

IF(Company,Company,

IF({Contact Last},{Contact Last}))))))

Nicole_Flewelle
6 - Interface Innovator
6 - Interface Innovator

@Jeremy_Oglesby Another If/Concatenate conundrum for you!

I have fields for each of 6 teams (Marketing, Graphics, Media Production, Editorial, Formatting, and Production) that I am trying to concatenate with a single other field (Document/Project Title). However, for each record, only one of those team fields will be filled in, so I need a formula that says:

IF Marketing, then Marketing and Document/Project Title; IF Graphics, then Graphics and Document/Project Title and so on.

Thanks in advance!

What kind of fields are these? Are they Linked Record fields? Single Select fields? May I ask why you have 6 different fields, instead of one field that holds all the Team options? (I’m sure you have a reason, I’m just curious what it is)

Does this mean it will alway, only, ever be the case that one of these fields will be filled in, while the other 5 are blank?

I want to withhold from offering an answer until you are able to clarify a bit, because the solution may depend on your configuration.

The fields are Collaborator fields. They’re for assignments (so I should correct my field titles, they’re actually Marketing Lead, Graphics Lead, Media Production Lead, Editorial Lead, Formatting Lead, and Production Lead)

There will always, only, ever, be one of these fields filled in at a time. We’re using a form to populate an OOO calendar (which integrates with our workload calendar, which is why there are separate fields for each team and not just a single “Name” field).

So, on the form, folks select their team (Marketing, Graphics, etc.), which then, through conditional formatting, displays the corresponding “Lead” Collaborator field, from which they select their name. So when the form entry comes through, only one “Lead” field will be filled in.