Library › Data AI › Marketing and content

Write a formula that pulls the company name from an email

  • For Marketing and content
  • You practice Setting limits and rules
  • Time about 5 minutes
  • Level Beginner

About this exercise

Your marketing list has an email column and you want just the company name in column B: the text between the @ and the first dot after it. Ask for one Excel formula for B2 in a single code block, then one line starting 'Example:' showing what it gives for one of the rows, under 8 words outside the code. The name must be lowercase, and a row with no @ should show Invalid.

Common mistakes when you ask AI for this

  • Leaving the capitals. The result keeps Brightwave.COM exactly as typed. Try: Add: "Take the text between the @ and the first dot, and wrap it in LOWER."
  • Errors on bad rows. The row with no @ shows #VALUE!. Try: Add: "If there is no @, return Invalid."
  • Forgetting the example line. The AI explains in a paragraph instead. Try: Add: "Then one line: Example: <email> -> <result>. Nothing else."
  • 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 8 words."

What a strong prompt includes

  • Names the functions
  • Asks for lowercase
  • Handles no @
  • Asks for the example line
  • Limits the output

Practice this now ↑

Related exercises