Library › Data AI › Office and admin

Look up host extensions on the visitor log from the staff tab

  • For Office and admin
  • You practice Giving the right context
  • Time about 5 minutes

About this exercise

You want column D of the Visitor Log to show each host's phone extension from the Staff tab. The front desk types host names with stray spaces, and names not on the Staff tab must show Ask front desk instead of an error. Ask for one formula for D2 in one code block, then exactly 2 numbered lines labeled Fixes: (what the formula handles) and Shows: (what Marta Gil's row will show). Under 45 words outside the code.

Common mistakes when you ask AI for this

  • Not mentioning the spaces. The AI writes a plain lookup, and "Marta Gil " with a trailing space never matches. Try: Add: "Host names have stray spaces; trim them."
  • No plan for missing names. The formula shows #N/A for contractors, the same problem as last week. Try: Add: "Show Ask front desk when the name isn't on Staff."
  • No check row. Without one known answer you can't tell if it works. Try: Add: "Shows: what Marta Gil's row will show."
  • 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 formula at length. Try: Add: "Each line under 15 words. Nothing else."

What a strong prompt includes

  • Mentions stray spaces
  • Handles missing names
  • Asks for a check row
  • Asks for one formula

Practice this now ↑

Related exercises