{"id":"data2-formula-goal-attainment-capped","audience":"finance","category":"spreadsheets","track":"data","technique":"constraints","level":"intermediate","title":"Write a formula for goal attainment capped at 100 percent","free":false,"task":"Your bonus sheet needs goal attainment in D2 from sales in B2 and goal in C2. Ask for one Excel formula in a single code block, then one line starting 'Example:' showing sales 120 against a goal of 100, under 12 words outside the code. Attainment is capped at 100% for bonus purposes, and a missing or zero goal should show the text n/a.","materialLabel":"Your sheet (attached to your prompt automatically)","material":"Sheet: Bonus (Excel 2016) - Sunrise Wholesale\n\nA Rep | B Sales | C Goal | D Attainment\nImani | 120,000 | 100,000 |\nGus | 85,000 | 100,000 |\nLee | 40,000 | (blank - new hire, no goal set) |\nPriya | 70,000 | 0 |\nChen | 100,000 | 100,000 |\n\nNotes:\n- D is formatted as a percent with no decimals.\n- Bonus rules cap attainment at 100%, even when sales are above goal.\n- Reps without a goal show n/a, as text.\n- About 80 reps in rows 2-81.\n- Do not use IFS, XLOOKUP or LET (Excel 2016).","rules":[{"type":"codeBlocks","count":1},{"type":"maxProseWords","max":12}],"mistakes":[{"title":"Letting it exceed 100%","why":"The AI returns 120% for the over-goal rep.","fix":"Add: \"Cap at 100%: MIN(1, B2/C2).\"","checks":["r0"]},{"title":"#DIV/0! errors","why":"Zero or blank goals produce errors.","fix":"Add: \"If C2 is blank or 0, return n/a.\"","checks":["r1"]},{"title":"Wrong Excel version","why":"The AI uses IFS, which Excel 2016 lacks.","fix":"Add: \"No IFS, XLOOKUP or LET.\"","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 12 words.\"","checks":["codeBlocks","maxProseWords"]}],"promptHints":[{"label":"Asks for the cap","patterns":["min\\(1","cap"]},{"label":"Handles the missing goal","patterns":["n/a","blank or 0"]},{"label":"Names the Excel version","patterns":["2016","no ifs"]},{"label":"Asks for the example","patterns":["example:"]},{"label":"Limits the output","patterns":["single code block","nothing else"]}],"hint":"Capped percentages and missing denominators are two edge cases to name in the prompt.","mission":"Write an attainment formula.","musts":["One formula","Capped at 100 percent","n/a when no goal"],"rubricLabels":["The formula divides B2 by C2 and caps the result at 1 using MIN(1, B2/C2) (or an equivalent IF), so 120,000 against 100,000 gives 100%","It returns the text \"n/a\" when C2 is blank or 0 (for example IF(OR(C2=\"\",C2=0),\"n/a\",...) or IFERROR)","It uses no IFS, XLOOKUP or LET, and the reply has a line starting 'Example:' showing 120 against 100 gives 100%"]}