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.

First_firstnameFirst_lastnameSecond_firstnameSecond_lastnameConcatenatedDesiredResults
JohnnyGiftcardSallyPatronJohnnyGiftcardSallyPatronJohnny Giftcard and Sally Patron
AllyFriendMikeFriendAlly and MikeFriendAlly and Mike Friend

<tbody>
</tbody>


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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
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,215,787
Messages
6,126,900
Members
449,348
Latest member
Rdeane

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