1. Lighthouse

Level 1 · Duplicate customers by email

The request

From Jennifer Castillo, Support Team Lead

“We keep getting tickets from people who have two accounts: two order histories, two welcome emails. Here's a slice of the customer export. Can you flag every account that shares its email with another one, so we can merge them?”

Your goal

In F2:F54, build a clean email key: the email in column D with spaces trimmed and in lower case. In G2:G54, use COUNTIF on that key column to return TRUE when the key appears more than once. In J1, count the flagged rows.

  • Fill F2:G54, J1 with the right valuesnot done yet
  • With formulas, not typed numbersnot done yet
  • Use COUNTIF TRIMnot done yet

Your sheet

Excel
The sheet for this level
ABCDEFGHIJK
1customer_idfirst_namelast_nameemailsignup_dateemail_keyduplicateRows flagged
21OwenHudsonowen.hudson@icloud.com2022-06-02
35KyleJimenezkjimenez27@yahoo.com2022-06-07
49NoahLongnlong74@yahoo.com2022-06-09
516BenjaminOrtizbenjamin.ortiz@icloud.com2022-06-18
633AnnaNguyenanna.nguyen@gmail.com2022-07-08
735MaryThomasmary.thomas2@gmail.com2022-07-12
850KatherineThomaskatherine.thomas@yahoo.com2022-07-30
952EmmaGrayemmagray1973@gmail.com2022-08-01
1053DennisAdamsdennis.adams@comcast.net2022-08-03
1157KyleHowardkyle.howard@gmail.com2022-08-10
1267NicoleJamesnicolejames1982@icloud.com2022-08-26
1387CynthiaRussellcynthia.russell@icloud.com2022-09-26
14101CharlesPerrycharles.perry@icloud.com2022-10-17
15115SofiaPricesofiaprice1966@gmail.com2022-11-10
16165TimothyDiaztimothy.diaz@outlook.com2023-01-12
17267EdwardRusselledwardrussell1996@gmail.com2023-04-20
18273VictoriaBaileyvbailey@redbrickworkspace.com2023-04-24
19355DouglasDiazddiaz@brightlinedesign.com2023-07-10
20389SandraLongsandralong1962@yahoo.com2023-08-10
21422MelissaBarnesmbarnes58@gmail.com2023-08-30
22455NoahBarnesnbarnes@parkrowhotels.com2023-09-27
23474AngelaJamesangelajames1993@gmail.com2023-10-07
24518JosephJonesjjones35@yahoo.com2023-11-06
25570LauraHudsonlhudson@northwindrentals.com2023-11-27
26601PriyaHowardpriya.howard@icloud.com2023-12-10
27605OwenAdamsowen.adams@yahoo.com2023-12-12
28680EthanGrayethan.gray@yahoo.com2024-01-24
29930SandraOrtizsortiz38@outlook.com2024-08-19
301125ElizabethPerryeperry89@yahoo.com2024-12-01
311287OwenBaileyowenbailey1975@yahoo.com2025-02-25
321364JamalDiazjdiaz14@hotmail.com2025-04-12
331439JackNguyenjack.nguyen@icloud.com2025-05-23
341527MiguelPricemiguel.price@hotmail.com2025-07-13
351530NicoleJimeneznicole.jimenez@yahoo.com2025-07-14
361698BrandonJonesbjones76@gmail.com2025-10-12
372001SandraOrtizsortiz38@outlook.com2025-06-24
382002NicoleJamesNICOLEJAMES1982@ICLOUD.COM2022-12-18
392003OwenHudson owen.hudson@icloud.com2023-08-15
402004EthanGrayethan.gray@yahoo.com2025-05-09
412005SandraLongSandralong1962@yahoo.com2023-09-21
422006EdwardRussell edwardrussell1996@gmail.com2023-12-20
432007JamalDiazjdiaz14@hotmail.com2025-12-31
442008MiguelPriceMIGUEL.PRICE@HOTMAIL.COM2025-12-31
452009OwenAdams owen.adams@yahoo.com2025-04-05
462010DouglasDiazddiaz@brightlinedesign.com2023-10-11
472011PriyaHowardPriya.howard@icloud.com2024-06-20
482012NoahBarnes nbarnes@parkrowhotels.com2024-09-30
492013NicoleJimeneznicole.jimenez@yahoo.com2025-12-31
502014BrandonJonesBJONES76@GMAIL.COM2025-12-31
512015JackNguyen jack.nguyen@icloud.com2025-07-22
522016MaryThomasmary.thomas2@gmail.com2022-08-13
532017ElizabethPerryEperry89@yahoo.com2025-09-20
542018OwenBailey owenbailey1975@yahoo.com2025-05-09
55
56

Loading the editor…

    ResultPress Check to compare F2:G54, J1

    Mote checks your result

    Press Check. Each right cell becomes a firefly in your lantern.

    The lesson

    A duplicate is rarely an exact copy. The same person signs up again on their phone, the keyboard capitalises the first letter, or a paste drags in a space. To a person, owen.hudson@icloud.com and ' owen.hudson@icloud.com' are one address. To a spreadsheet they are two different strings. So the honest way to find duplicates has two parts: clean the value into a key, then count the key.

    Counting with COUNTIF

    COUNTIF(range, criteria) counts the cells in a range that match a value:

    =COUNTIF($F$2:$F$54,F2)

    reads “how many cells in F2:F54 hold the same value as F2”. Every row finds at least itself, so the answer is 1 for a unique email and 2 or more for a duplicate. Add >1 and the cell becomes a TRUE/FALSE flag:

    =COUNTIF($F$2:$F$54,F2)>1

    The range is locked with $ because every row must search the same column. Unlocked, G3 would search F3:F55, and the last rows would search almost nothing.

    What COUNTIF already forgives, and what it doesn’t

    Try the quick version first, straight on the raw emails:

    =COUNTIF($D$2:$D$54,D2)>1

    It flags 24 rows. COUNTIF compares text without caring about case, so NICOLEJAMES1982@ICLOUD.COM in D38 matches nicolejames1982@icloud.com in D12. But it does compare spaces: D39 holds ' owen.hudson@icloud.com' with a leading space, and D2 holds the address without it. Those two never match. Six accounts in this slice differ from their original only by that space, so the raw count misses 12 rows, both halves of six pairs.

    Original Duplicate Raw COUNTIF
    sortiz38@outlook.com (D29) same text (D37) found
    nicolejames1982@icloud.com (D12) NICOLEJAMES1982@ICLOUD.COM (D38) found (case is ignored)
    owen.hudson@icloud.com (D2) ' owen.hudson@icloud.com' (D39) missed (the space counts)

    Build the key first

    A helper column holds the cleaned value so the count can work on it:

    F2   =LOWER(TRIM(D2))

    TRIM removes spaces at both ends (and squeezes double spaces inside to one). LOWER puts every letter in lower case. COUNTIF would forgive the case anyway, but the key should be clean on its own: other tools that will use this column, like SQL, pandas or a merge in your CRM, do care about case. Fill it down, then count the key:

    G2   =COUNTIF($F$2:$F$54,F2)>1

    Now all 18 pairs show up: 36 rows flagged. In J1, =COUNTIF(G2:G54,TRUE) counts them, and that number is your sanity check. Each duplicate account comes with its original, so the count should be even. An odd number means a key you didn’t expect.

    Same name is not the same person

    Douglas Diaz (row 19), Jamal Diaz (row 32) and Timothy Diaz (row 16) are different customers with different emails, and the key keeps them apart. Matching on names would merge strangers.

    Which copy to keep is a business call, not a formula. Here the duplicates have the higher ids and no orders, so support keeps the original and moves the login over.

    Excel’s own tools: highlight, then remove

    Desktop Excel has two built-in tools for this, and both work best on the key column you just built:

    • See them: select F2:F54, then Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values. Every key that appears more than once turns red. Like COUNTIF, the rule ignores case and doesn’t trim, which is why you run it on F, not on the raw emails in D. Sorting by the key puts each pair on neighbouring rows.
    • Remove them: click inside the data, Data > Data Tools > Remove Duplicates, tick “My data has headers”, and tick only email_key as the column that decides. Excel keeps the first row of each group, top to bottom, and deletes the rest. Sorted by customer_id as here, that keeps the original account.

    Remove Duplicates changes the data and tells you only how many rows went. Run it on a copy, after the flag column has shown you exactly what it will remove. Google Sheets has the same tool under Data > Data cleanup > Remove duplicates.

    Common mistakes

    • Counting the raw column. It looks right because most pairs appear; the ones with a stray space don’t.
    • An unlocked range. =COUNTIF(F2:F54,F2) filled down becomes COUNTIF(F54:F106,F54) by the last row, and the bottom rows stop finding their pairs.
    • Flagging only the second copy. COUNTIF(...)>1 marks both halves of a pair on purpose. To mark only the later one, count the rows above: =COUNTIF($F$2:F2,F2)>1.

    Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.