Library › Coding AI › Marketing and content
Pull company domains from lead emails, flag personal ones
Practice: Giving the right context. About 5 minutes.
About this exercise
Write one Google Sheets formula for C2 (filled down) that pulls the domain from the email in B2, lowercased (Ana@Birch-Cole.example gives birch-cole.example). If the domain is on your personal-email list in Lists!$A$2:$A$20, show Personal instead, and leave C2 blank when B2 is empty. One formula in one code block, then under 25 words outside the code.
Common mistakes when you ask AI for this
- Not saying lowercase. The AI keeps capitals, so RIDGEAUTO.EXAMPLE and ridgeauto.example look like two companies. Try: Add: "Lowercase the domain."
- Not pointing at your list. The AI types its own guesses of personal providers into the formula. Try: Add: "If the domain is in Lists!$A$2:$A$20, show Personal."
- Forgetting walk-ins. An empty email gives an error in the domain column. Try: Add: "If B2 is empty, leave C2 blank."
- Getting a menu of options. The AI likes to offer two or three versions of the formula, so you're left to pick and test them yourself. Try: Add: "Give one formula only, in one code block, no alternatives."
- Getting a tutorial. By default the AI explains every part of the code at length, which you then have to scroll past. Try: Add: "After the code, one line under 10 words. Nothing else."
What a strong prompt includes
- Asks for lowercase
- Points at the personal list
- Handles empty emails
- Asks for one answer only
- Limits the explanation
Related exercises
- Add a cron line that matches the others in a crontab (Coding AI · Product managers)
- Add dark mode by overriding your existing CSS variables (Coding AI · Software developers)
- Add input checks to your number guessing game (Coding AI · High school students)
- Add input validation to a Java method with exact messages (Coding AI · Software developers)
- Add labels to a signup form without rewriting the page (Coding AI · High school students)