# Combining two fields with comma when either might be blank

Topic Labels: Formulas
Solved
Jump to Solution
1085 7
cancel
Showing results for
Search instead for
Did you mean:
4 - Data Explorer

Trying to get 'Full Name', 'Organization' in my primary field. My problem is that sometimes both 'Full Name' and 'Organization' are filled in, and sometimes it's only one or the other. I tried using the following formula, and it worked when one or the other is filled in, but when both are filled in, it doesn't add the comma and space. I'll attach an image so it's clear what I mean.

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

1 Solution

Accepted Solutions
12 - Earth

I guess your {Full Name} formula is something like {First Name} & " " & {Last Name}, so it is never empty.
You can wrap it all into TRIM(   ) and that will solve the problem.
Or you can trim it in the Customer formula,

I think, that should work OK:

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

7 Replies 7
11 - Venus

In Airtable, for example, the formula would look like this

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

12 - Earth

Hi,

IF(Field1 + Field2, ....         - doesn't work
there are two ways to check,
IF(AND(Field1,Field2), 'both not empty')  or
IF(Field1, IF(Field2,'both not empty'))

Regarding your formula, part of it is redundant.
Your desired result is

{Full Name} & ", " & {Organization}

when a field (any or both) is empty, nothing changes for side parts.  But delimiter needs only for 2 values, so

{Full Name} & IF({Full Name},IF({Organization},", ")) & {Organization}
4 - Data Explorer

Tried this and while it inserted the comma when both 'Full Name' and 'Organization' were found, it also inserted the comma and a space before the organization when only the 'Organization' was found.

4 - Data Explorer

This, too, like the previous suggestion, inserted the comma when both 'Full Name' and 'Organization' were found—but also inserted the comma and a space before the organization when only the 'Organization' was found.

11 - Venus

If so, the Full Name may contain spaces.
Please check the formula.

12 - Earth

I guess your {Full Name} formula is something like {First Name} & " " & {Last Name}, so it is never empty.
You can wrap it all into TRIM(   ) and that will solve the problem.
Or you can trim it in the Customer formula,

I think, that should work OK:

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

4 - Data Explorer

Hey, thanks! That did the trick!