Library › Coding AI › Office and admin

Flip "LAST, first" names into clean First Last

Practice: Showing an example of what you want. About 5 minutes.

About this exercise

Column A of the Google Sheet has visitor names typed every which way, mostly as Last, First. You need one formula for B2 (filled down) that returns First Last in proper case with no extra spaces, e.g. " ORTIZ, ana " becomes "Ana Ortiz". Names typed without a comma must come out proper-cased and trimmed, not as an error. One formula in one code block, at most 3 lines, then under 20 words outside the code.

Common mistakes when you ask AI for this

  • Not showing the target. The AI guesses at the format and may keep Last, First or ALL CAPS. Try: Add an example: "' ORTIZ, ana ' becomes 'Ana Ortiz'."
  • Forgetting the odd rows. The AI splits on the comma and returns an error when there isn't one. Try: Add: "Names with no comma: just trim and proper-case them."
  • 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."
  • Letting the code sprawl. The AI pads the formula with extras nobody asked for, so it grows long and harder to check. Try: Add: "At most 3 lines of code."
  • 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 12 words. Nothing else."

What a strong prompt includes

  • Shows an example
  • Covers names without a comma
  • Asks for proper case and trimming
  • Asks for one answer only
  • Limits the explanation

Practice this now ↑

Related exercises