{"id":"code-work-fin-ar-aging-buckets","audience":"finance","category":"coding","track":"coding","technique":"constraints","title":"Bucket unpaid invoices by days past due","free":false,"task":"Write the aging bucket formula for AR!F2 (filled down). Measure from the month-end date you keep in cell $H$1, not today's date: days late = $H$1 minus the due date in D2. Negative amounts in C are credit memos and must show Credit before any date check. Use exactly these labels: 0 or fewer days is Not due, then 1-30, 31-60, 61-90, and 91 or more is 91+ (the pivot table matches on these exact labels). One formula in one code block, at most 3 lines, then under 20 words outside the code.","materialLabel":"AR sheet preview (attached to your prompt automatically)","material":"AR sheet - open receivables, Northgate Supply (row 1 is headers, rows 2-180)\nA Invoice | B Customer | C Amount | D Due date | E Terms | F Bucket\nINV-3301 | Lakeview Dental | $4,200 | 09/15/2026 | Net 30 | ?\nINV-3317 | Birch & Cole | $860 | 10/01/2026 | Net 15 | ?\nCM-0042 | Birch & Cole | -$120 | 10/01/2026 | Net 15 | ?\nINV-3322 | Okafor Catering | $12,500 | 10/31/2026 | Net 30 | ?\nINV-3340 | Ridge Auto | $1,150 | 11/20/2026 | Net 30 | ?\nINV-3288 | Mesa Florists | $2,975 | 07/02/2026 | Net 45 | ?\n\nNotes from Kofi (controller):\n- Columns A-E come from the billing export; don't move them.\n- Customers on Net 45 were moved to Net 30 starting in January.\n- Last quarter about 6% of AR was more than 90 days late.\n- The export runs overnight, so it's always one day behind.","rules":[{"type":"codeBlocks","count":1},{"type":"maxCodeLines","max":3},{"type":"maxProseWords","max":20}],"mistakes":[{"title":"Not giving the as-of date","why":"The AI uses TODAY(), so the report changes every day and won't tie to month-end.","fix":"Add: \"Use the date in $H$1, not TODAY().\"","checks":["r0"]},{"title":"Forgetting the credit memos","why":"The AI can't know a negative amount means a credit, so credits land in an aging bucket.","fix":"Add: \"Negative amounts show Credit, checked first.\"","checks":["r1"]},{"title":"Leaving the labels open","why":"The AI picks its own bucket names and cutoffs, so your pivot table breaks.","fix":"List them exactly: \"Not due, 1-30, 31-60, 61-90, 91+.\"","checks":["r2"]},{"title":"Getting a menu of options","why":"The AI likes to offer two or three versions of the formula, so you're left to pick and test them yourself.","fix":"Add: \"Give one formula only, in one code block, no alternatives.\"","checks":["codeBlocks","maxCodeLines"]},{"title":"Getting a tutorial","why":"By default the AI explains every part of the code at length, which you then have to scroll past.","fix":"Add: \"After the code, one line under 12 words. Nothing else.\"","checks":["maxProseWords"]}],"promptHints":[{"label":"Uses the as-of date","patterns":["h1","as-?of","not today","month-?end"]},{"label":"Handles credit memos","patterns":["credit","negative"]},{"label":"Spells out the buckets","patterns":["1-30","31-60","91\\+","not due"]},{"label":"Asks for one answer only","patterns":["\\b(one|single|1)\\s+(formula|code block|block|version)","only one","no (alternatives|options|other versions)"]},{"label":"Limits the explanation","patterns":["\\d+\\s*words","no (explanation|notes|commentary)","one (short )?(line|sentence)","nothing else"]}],"hint":"Tell the AI which date to measure from, what a negative amount means, and the exact bucket labels.","rubricLabels":["Calculates days late as $H$1 minus D2, not with TODAY()","Returns Credit when C2 is negative, checked before any of the date buckets","Uses exactly the labels Not due, 1-30, 31-60, 61-90 and 91+ (not \"Current\", \"90+\" or \"Over 90\"), with 0 or less as Not due, 30 as 1-30, 31 as 31-60, 90 as 61-90 and 91 or more as 91+"]}