Sheetwise
Google Sheets · Video available

Duplicate Emails: Keep the First Contact

Keep the first complete contact for each email, even when plans differ.

Download practice data · CSVStart the exercise

Watch the tutorial

Watch on YouTube · Short

Try it yourself

Import at A1. In D2 enter =COUNTIF($B$2:B2,B2)=1 and copy through D8. In F2 enter =FILTER(A2:C8,D2:D8,B2:B8<>""). Expect Alex/Basic, Jamie/Pro, Sam/Basic, Lee/Pro. Source order decides the winner, not the newest plan. Blank email rows are excluded. COUNTIF is case-insensitive; wildcard characters need special care.

=FILTER(A2:C8,D2:D8,B2:B8<>"")

First means source order, not the best contact

The helper checks whether an email has appeared from the first data row through the current row. Only its first occurrence is TRUE, and FILTER keeps that entire contact. This solves a different problem from UNIQUE across all columns: two rows can share an email while storing different plans. Decide the winning order before you use the result.

When the result looks wrong

Sorting the source can change which plan survives. This method does not merge fields, find the latest timestamp or resolve customer conflicts. Blank emails are excluded. COUNTIF ignores case and interprets wildcards, so unusual address characters and whitespace need deliberate handling outside this simple exercise.

A check you can repeat

The output is Alex/Basic, Jamie/Pro, Sam/Basic and Lee/Pro. Alex/Enterprise is not kept because Alex/Basic comes first. In a test copy, swapping those two source rows should change the retained Alex plan to Enterprise.

Preview the input data

NameEmailPlan
Alexalex@example.comBasic
Jamiejamie@example.comPro
Alexalex@example.comEnterprise
Samsam@example.comBasic
Jamiejamie@example.comBasic
Leelee@example.comPro
No emailReview

Need help importing, choosing separators or setting the locale? How to use the practice files.

Continue with a related problem