Concatenate function with if statement for creating mailing list salutations

LadyMagnus

New Member
Joined
Sep 22, 2015
Messages
7
Hi, I work for an organization that has just changed our CRM. Our previous CRM database allowed for us to save salutations for the purposes of creating mailing lists. The new database doesn't have that feature for exported mailing lists, so I am trying to recreate it with the Concatenate function.

The end goal of our salutations is that if there are two people on the record the salutation will be as follows:

John and Jane Doe (if their last name is the same) or John Smith and Jane Doe (if their last name is different)

I wrote this formula, but and I'm very close to get the correct output, but the results are slightly off:
=CONCATENATE(A2, IF(B2=D2, " and ", B2), C2, IF(B2=D2, B2, D2))

below is my sample data and results.

[TABLE="width: 700"]
<tbody>[TR]
[TD]First_firstname[/TD]
[TD]First_lastname[/TD]
[TD]Second_firstname[/TD]
[TD]Second_lastname[/TD]
[TD]Concatenated[/TD]
[TD]DesiredResults[/TD]
[/TR]
[TR]
[TD]Johnny[/TD]
[TD]Giftcard[/TD]
[TD]Sally[/TD]
[TD]Patron[/TD]
[TD]JohnnyGiftcardSallyPatron[/TD]
[TD]Johnny Giftcard and Sally Patron[/TD]
[/TR]
[TR]
[TD]Ally[/TD]
[TD]Friend[/TD]
[TD]Mike[/TD]
[TD]Friend[/TD]
[TD]Ally and MikeFriend[/TD]
[TD]Ally and Mike Friend[/TD]
[/TR]
</tbody>[/TABLE]


for row 1 I am not getting spaces between the the names and I'm not getting and. For row 1 I am not getting a space between the second_firstname and second_lastname.

any insight would be very appreciated!! Thanks!! I am using Excel 2013
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
this is working perfectly!!!

Thank you so much! this is much easier than the concatenate function.

note: I used your logic here to fix my concatenate function and came up with: =CONCATENATE(A2,IF(B2=D2," and ", (" " & B2 & " and ")),C2,IF(B2=D2," " & B2, " " & D2)) This gives the same results as the function you provided me, but I like yours better because it doesn't rely on concatenate which is sometimes fussy or problematic.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top