Library › Data AI › Operations and supply chain
Dedupe a contact list by email with a keep rule
- For Operations and supply chain
- You practice Setting limits and rules
- Time about 5 minutes
- Level Advanced
About this exercise
Your CRM export has duplicate contacts and you need one row per person. Write one CSV block (one code block) with the header email,name,updated,phone and one row per unique email, sorted by email, at most 15 words outside it. Treat emails as the same ignoring capitals, write them in lowercase, and keep the most recently updated row. If two duplicates share the latest date, keep the one with a phone number. Don't merge fields.
Common mistakes when you ask AI for this
- Merging fields. The AI copies Tia's old phone onto the newest row. Try: Add: "Don't merge fields between rows."
- Wrong tie-break. For Lee's tie the AI keeps the first or last row randomly. Try: Add: "If two rows tie on the latest date, keep the one with a phone number."
- Case-sensitive duplicates. The AI treats Ana.Ruiz@ and ana.ruiz@ as different people. Try: Add: "Treat capitals as the same and lowercase every email."
- Leaving the format to chance. The AI picks its own length and layout unless told the exact shape. Try: Add: "Put the code in exactly 1 code block. Keep the writing outside the code under 15 words."
What a strong prompt includes
- Asks for lowercase emails
- Gives the keep rule
- Gives the tie-break
- Says don't merge
- Names the header
Related exercises
- Accept the buyer's counteroffer on three stated conditions (Sales AI · Sales and customer success)
- Accrue goods received but not invoiced at PO price (Finance AI · Accountants)
- Acknowledge a cancellation request without a save attempt (Customer Support & Success AI · Customer success managers)
- Acknowledge an accessibility bug without a promised date (Customer Support & Success AI · Customer support teams)
- Add dark mode by overriding your existing CSS variables (Coding AI · Software developers)