The request

From Jennifer Castillo, Support Team Lead
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, J1with the right valuesnot done yet - With formulas, not typed numbersnot done yet
- Use
COUNTIFTRIMnot done yet
Your sheet
| A | B | C | D | E | F | G | H | I | J | K | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | customer_id | first_name | last_name | signup_date | email_key | duplicate | Rows flagged | ||||
| 2 | 1 | Owen | Hudson | owen.hudson@icloud.com | 2022-06-02 | ||||||
| 3 | 5 | Kyle | Jimenez | kjimenez27@yahoo.com | 2022-06-07 | ||||||
| 4 | 9 | Noah | Long | nlong74@yahoo.com | 2022-06-09 | ||||||
| 5 | 16 | Benjamin | Ortiz | benjamin.ortiz@icloud.com | 2022-06-18 | ||||||
| 6 | 33 | Anna | Nguyen | anna.nguyen@gmail.com | 2022-07-08 | ||||||
| 7 | 35 | Mary | Thomas | mary.thomas2@gmail.com | 2022-07-12 | ||||||
| 8 | 50 | Katherine | Thomas | katherine.thomas@yahoo.com | 2022-07-30 | ||||||
| 9 | 52 | Emma | Gray | emmagray1973@gmail.com | 2022-08-01 | ||||||
| 10 | 53 | Dennis | Adams | dennis.adams@comcast.net | 2022-08-03 | ||||||
| 11 | 57 | Kyle | Howard | kyle.howard@gmail.com | 2022-08-10 | ||||||
| 12 | 67 | Nicole | James | nicolejames1982@icloud.com | 2022-08-26 | ||||||
| 13 | 87 | Cynthia | Russell | cynthia.russell@icloud.com | 2022-09-26 | ||||||
| 14 | 101 | Charles | Perry | charles.perry@icloud.com | 2022-10-17 | ||||||
| 15 | 115 | Sofia | Price | sofiaprice1966@gmail.com | 2022-11-10 | ||||||
| 16 | 165 | Timothy | Diaz | timothy.diaz@outlook.com | 2023-01-12 | ||||||
| 17 | 267 | Edward | Russell | edwardrussell1996@gmail.com | 2023-04-20 | ||||||
| 18 | 273 | Victoria | Bailey | vbailey@redbrickworkspace.com | 2023-04-24 | ||||||
| 19 | 355 | Douglas | Diaz | ddiaz@brightlinedesign.com | 2023-07-10 | ||||||
| 20 | 389 | Sandra | Long | sandralong1962@yahoo.com | 2023-08-10 | ||||||
| 21 | 422 | Melissa | Barnes | mbarnes58@gmail.com | 2023-08-30 | ||||||
| 22 | 455 | Noah | Barnes | nbarnes@parkrowhotels.com | 2023-09-27 | ||||||
| 23 | 474 | Angela | James | angelajames1993@gmail.com | 2023-10-07 | ||||||
| 24 | 518 | Joseph | Jones | jjones35@yahoo.com | 2023-11-06 | ||||||
| 25 | 570 | Laura | Hudson | lhudson@northwindrentals.com | 2023-11-27 | ||||||
| 26 | 601 | Priya | Howard | priya.howard@icloud.com | 2023-12-10 | ||||||
| 27 | 605 | Owen | Adams | owen.adams@yahoo.com | 2023-12-12 | ||||||
| 28 | 680 | Ethan | Gray | ethan.gray@yahoo.com | 2024-01-24 | ||||||
| 29 | 930 | Sandra | Ortiz | sortiz38@outlook.com | 2024-08-19 | ||||||
| 30 | 1125 | Elizabeth | Perry | eperry89@yahoo.com | 2024-12-01 | ||||||
| 31 | 1287 | Owen | Bailey | owenbailey1975@yahoo.com | 2025-02-25 | ||||||
| 32 | 1364 | Jamal | Diaz | jdiaz14@hotmail.com | 2025-04-12 | ||||||
| 33 | 1439 | Jack | Nguyen | jack.nguyen@icloud.com | 2025-05-23 | ||||||
| 34 | 1527 | Miguel | Price | miguel.price@hotmail.com | 2025-07-13 | ||||||
| 35 | 1530 | Nicole | Jimenez | nicole.jimenez@yahoo.com | 2025-07-14 | ||||||
| 36 | 1698 | Brandon | Jones | bjones76@gmail.com | 2025-10-12 | ||||||
| 37 | 2001 | Sandra | Ortiz | sortiz38@outlook.com | 2025-06-24 | ||||||
| 38 | 2002 | Nicole | James | NICOLEJAMES1982@ICLOUD.COM | 2022-12-18 | ||||||
| 39 | 2003 | Owen | Hudson | owen.hudson@icloud.com | 2023-08-15 | ||||||
| 40 | 2004 | Ethan | Gray | ethan.gray@yahoo.com | 2025-05-09 | ||||||
| 41 | 2005 | Sandra | Long | Sandralong1962@yahoo.com | 2023-09-21 | ||||||
| 42 | 2006 | Edward | Russell | edwardrussell1996@gmail.com | 2023-12-20 | ||||||
| 43 | 2007 | Jamal | Diaz | jdiaz14@hotmail.com | 2025-12-31 | ||||||
| 44 | 2008 | Miguel | Price | MIGUEL.PRICE@HOTMAIL.COM | 2025-12-31 | ||||||
| 45 | 2009 | Owen | Adams | owen.adams@yahoo.com | 2025-04-05 | ||||||
| 46 | 2010 | Douglas | Diaz | ddiaz@brightlinedesign.com | 2023-10-11 | ||||||
| 47 | 2011 | Priya | Howard | Priya.howard@icloud.com | 2024-06-20 | ||||||
| 48 | 2012 | Noah | Barnes | nbarnes@parkrowhotels.com | 2024-09-30 | ||||||
| 49 | 2013 | Nicole | Jimenez | nicole.jimenez@yahoo.com | 2025-12-31 | ||||||
| 50 | 2014 | Brandon | Jones | BJONES76@GMAIL.COM | 2025-12-31 | ||||||
| 51 | 2015 | Jack | Nguyen | jack.nguyen@icloud.com | 2025-07-22 | ||||||
| 52 | 2016 | Mary | Thomas | mary.thomas2@gmail.com | 2022-08-13 | ||||||
| 53 | 2017 | Elizabeth | Perry | Eperry89@yahoo.com | 2025-09-20 | ||||||
| 54 | 2018 | Owen | Bailey | owenbailey1975@yahoo.com | 2025-05-09 | ||||||
| 55 | |||||||||||
| 56 |
Loading the editor…
Reference solution
Mote checks your result
Press Check. Each right cell becomes a firefly in your lantern.
What Jennifer gets, and why
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. LikeCOUNTIF, the rule ignores case and doesn’t trim, which is why you run it onF, not on the raw emails inD. 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_keyas the column that decides. Excel keeps the first row of each group, top to bottom, and deletes the rest. Sorted bycustomer_idas 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 becomesCOUNTIF(F54:F106,F54)by the last row, and the bottom rows stop finding their pairs. - Flagging only the second copy.
COUNTIF(...)>1marks both halves of a pair on purpose. To mark only the later one, count the rows above:=COUNTIF($F$2:F2,F2)>1.
Lantern lit!
Practised: duplicatescountiftrimlowerhelper columns
- Solved
- No hints
- First run
