{"id":"sheet-off-flag-repeat-invoice-numbers","audience":"office","category":"spreadsheets","track":"data","technique":"constraints","title":"Flag repeat invoice numbers without flagging the first one","free":false,"task":"You want column F of the Invoices sheet to say Duplicate on the second and later copies of an invoice number in column A, while the first copy stays blank so it still gets paid. Ask for one formula for F2 that works when filled down to F500, in one code block, then exactly 2 numbered lines labeled Flags: (in plain words) and Check: (what rows 2 and 5 will show). Under 45 words outside the code.","materialLabel":"Your Invoices sheet (attached to your prompt automatically)","material":"Sheet: Invoices (Excel), rows 2-500\n\nRow | A Invoice # | B Vendor | C Amount | D Received | E Approver | F Duplicate?\n2 | INV-1042 | Brightline Paper | 1,240.00 | 2026-10-02 | Rosa |\n3 | INV-1043 | Cedar Cleaning | 860.00 | 2026-10-03 | Rosa |\n4 | INV-2210 | Metro Courier | 95.50 | 2026-10-05 | Tim |\n5 | INV-1042 | Brightline Paper | 1,240.00 | 2026-10-09 | Tim |\n6 | INV-3301 | Hollis Print | 410.00 | 2026-10-12 | Rosa |\n7 | INV-1042 | Brightline Paper | 1,240.00 | 2026-10-20 | Rosa |\n\nNotes:\n- Brightline emailed the same invoice three times\n- Last month a formula flagged every copy, including the first, and the vendor didn't get paid at all\n- AP pays anything with a blank in column F","rules":[{"type":"codeBlocks","count":1},{"type":"numberedItems","count":2},{"type":"maxProseWords","max":45}],"mistakes":[{"title":"Not saying the first copy stays blank","why":"The AI counts the whole column, so every copy gets flagged and the vendor isn't paid.","fix":"Add: \"Flag the second and later copies only; the first stays blank.\"","checks":["r0"]},{"title":"Leaving the output open","why":"The AI returns TRUE/FALSE or a count, but AP looks for a blank.","fix":"Add: \"Show Duplicate or a blank.\"","checks":["r1"]},{"title":"No check rows","why":"Without known answers, you can't tell if it works.","fix":"Add: \"Check: what rows 2 and 5 will show.\"","checks":["r2","numberedItems"]},{"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"]},{"title":"Getting a tutorial","why":"By default the AI explains every part of the formula at length.","fix":"Add: \"Each line under 15 words. Nothing else.\"","checks":["maxProseWords"]}],"promptHints":[{"label":"Keeps the first copy blank","patterns":["first (copy|one)","second and later","later copies"]},{"label":"Says what to show","patterns":["duplicate","blank"]},{"label":"Mentions filling down","patterns":["fill(ed)? down","f500","every row"]},{"label":"Asks for check rows","patterns":["check","row 5","row 2"]},{"label":"Asks for one formula","patterns":["one formula","one code block","single formula","no alternatives"]}],"hint":"\"Find duplicates\" can mean flag all copies or only the extras. Say which, and ask for two rows whose answers you know.","rubricLabels":["The formula counts matches only from the top of the column down to the current row, using a range that grows as it fills down (for example COUNTIF($A$2:A2,A2))","The formula shows Duplicate when that count is more than 1 and a blank otherwise (for example =IF(COUNTIF($A$2:A2,A2)>1,\"Duplicate\",\"\"))","After the code there are 2 numbered lines labeled Flags: (later copies only) and Check: (row 2 stays blank and row 5 shows Duplicate)"]}