# Formula to add email address in name formula in case of duplicate contact

**URL:** <https://community.fibery.io/t/formula-to-add-email-address-in-name-formula-in-case-of-duplicate-contact/4703>\
**Category:** Get Help\
**Created:** [July 1, 2023, 3:01pm UTC](https://community.fibery.io/t/formula-to-add-email-address-in-name-formula-in-case-of-duplicate-contact/4703 "2023-07-01T15:01:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [July 1, 2023, 3:01pm UTC](https://community.fibery.io/t/formula-to-add-email-address-in-name-formula-in-case-of-duplicate-contact/4703/1 "2023-07-01T15:01:46Z")

</div>

I currently have a name formula in my contact database that combines first name and last name of a contact. Now I want to add the email address in case that a contact with the same first name and last name occurs more than once in contact database. So that it ultimately shows as ‘Yvette Lans - yvette@acceleright.nl’ if there are two Yvette Lans.

It shouldn’t be that hard. But tried several things without any success.

Hope somebody can help me out 😅 Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 1, 2023, 3:13pm UTC](https://community.fibery.io/t/formula-to-add-email-address-in-name-formula-in-case-of-duplicate-contact/4703/2 "2023-07-01T15:13:33Z")

</div>

Have you tried

```auto
FirstName + " " + LastName + " - " + Email

```

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [July 1, 2023, 3:28pm UTC](https://community.fibery.io/t/formula-to-add-email-address-in-name-formula-in-case-of-duplicate-contact/4703/3 "2023-07-01T15:28:27Z")

</div>

Yes, but there should be some logic.

- If a contact occurs once with first name + last name, then formula should be "FirstName + " " + LastName + " - "
- If a contact occurs more than once in contact database then it should be “FirstName + " " + LastName + " - " + Email”

My idea was to create a checkbox that decides if a contact occurs more than once. If so, then that checkbox will trigger in name formula that + Email should be added.

For the checkbox I was thinking about something like this  
Contacts.Filter(  
[First name] and [Last name]  
).Count() \> 1,  
true, false

But can’t use Contacts.Filter 🤷🏻‍♀️

Could do it via automation but rather do it via formulas in contact database.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 1, 2023, 4:38pm UTC](https://community.fibery.io/t/formula-to-add-email-address-in-name-formula-in-case-of-duplicate-contact/4703/4 "2023-07-01T16:38:41Z")

</div>

So you want to not show the email if the contact is not a duplicate?

You could create a (hidden) many-to-many self relation that matches first name and last name, and then use  
`FirstName + " " + LastName + if(Matches.Count() > 1," - " + Email,"")`

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [July 1, 2023, 6:59pm UTC](https://community.fibery.io/t/formula-to-add-email-address-in-name-formula-in-case-of-duplicate-contact/4703/5 "2023-07-01T18:59:02Z")

</div>

That’s briliant! Thanks again!!
