{"id":"data2-formula-clean-product-names","audience":"office","category":"spreadsheets","track":"data","technique":"constraints","level":"beginner","title":"Write a formula that cleans messy product names","free":false,"task":"Your product list has stray spaces and mixed capitals. Ask for one Excel formula for B2 in a single code block, then one line starting 'Example:' showing one row before and after, under 15 words outside the code. It should trim extra spaces, replace non-breaking spaces from web copy, and use Proper Case.","materialLabel":"Your sheet (attached to your prompt automatically)","material":"Sheet: Catalog (Excel)\n\nA Product name as pasted | B Clean name\n  oak   DESK lamp |\nCedar bookshelf  |\nPINE  coffee table |\nwalnut  side  table |\nBirch chair (copied from the website with hidden spaces) |\n\nNotes:\n- About 500 rows, rows 2-501.\n- Some rows came from a web page and contain non-breaking spaces (character 160), which TRIM does not remove.\n- Words may be separated by two or three spaces.\n- Leading and trailing spaces must go.\n- Excel 2016.\n- Do not use Power Query, VBA or Find and Replace; the formula must work in the sheet.","rules":[{"type":"codeBlocks","count":1},{"type":"maxProseWords","max":15}],"mistakes":[{"title":"Using TRIM alone","why":"TRIM leaves the hidden non-breaking spaces from the website copy.","fix":"Add: \"SUBSTITUTE CHAR(160) with a normal space before TRIM.\"","checks":["r0"]},{"title":"Wrong order or case","why":"The AI applies PROPER first or leaves capitals alone.","fix":"Add: \"Wrap it all in PROPER(TRIM(...)).\"","checks":["r1"]},{"title":"Extra tools and chatter","why":"The AI suggests Power Query and explains each function.","fix":"Add: \"One formula in one code block, then an Example: line. Nothing else.\"","checks":["r2"]},{"title":"Leaving the format to chance","why":"The AI picks its own length and layout unless told the exact shape.","fix":"Add: \"Put the code in exactly 1 code block. Keep the writing outside the code under 15 words.\"","checks":["codeBlocks","maxProseWords"]}],"promptHints":[{"label":"Names CHAR(160)","patterns":["char\\(160\\)","non.breaking","160"]},{"label":"Names the functions","patterns":["trim","proper","substitute"]},{"label":"Rules out extra tools","patterns":["no power query","no vba"]},{"label":"Asks for an example line","patterns":["example:"]},{"label":"Limits the output","patterns":["single code block","nothing else"]}],"hint":"TRIM alone misses web-copy spaces. Name the character and the order of functions.","mission":"Clean up these product names in Excel.","musts":["One formula","Handle non-breaking spaces","Proper Case"],"rubricLabels":["The formula replaces character 160 with a normal space (SUBSTITUTE(A2,CHAR(160),\" \")) before trimming","The formula wraps TRIM and PROPER together so repeated spaces collapse to one and the result is Proper Case, for example =PROPER(TRIM(SUBSTITUTE(A2,CHAR(160),\" \")))","There is a single formula in one code block (no Power Query or VBA), followed by a line starting 'Example:'"]}