{"id":"code-work-fin-running-balance-bank-view","audience":"finance","category":"coding","track":"coding","technique":"context","title":"Build a running balance where debits mean money out","free":false,"task":"Write one formula for Ledger!F2 that you can fill down unchanged, giving the running balance after each line. Start from the opening balance in $H$1. This export is from the bank's side, so Debit (column D) is money out and Credit (column E) is money in. Use expanding ranges anchored at row 2, so row 2 needs no special formula. One formula in one code block, then under 25 words outside the code.","materialLabel":"Ledger export preview (attached to your prompt automatically)","material":"LEDGER sheet - operating account, exported from the bank portal (row 1 is headers)\nA Date | B Payee | C Ref | D Debit | E Credit | F Balance\n10/01/2026 | Kopa Office Supply | CHK 2210 | 1,250.00 | | ?\n10/02/2026 | Lakeview Dental | DEP | | 4,200.00 | ?\n10/04/2026 | Fleetline Insurance | ACH | 310.45 | | ?\n10/09/2026 | Bank charge | FEE | 15.00 | | ?\n10/12/2026 | Okafor Catering | DEP | | 6,000.00 | ?\n\nH1: 18,420.10 (opening balance on Oct 1)\n\nNotes from Ama:\n- Blank debit or credit cells are truly empty, not zero.\n- The bank's own balance column was dropped from this export last month.\n- We reconcile to the bank statement on the 5th.\n- Our accounting software uses the opposite meaning for debit and credit on the cash account.","rules":[{"type":"codeBlocks","count":1},{"type":"maxProseWords","max":25}],"mistakes":[{"title":"Not saying whose side it is","why":"The AI uses the accounting meaning and adds debits, so the balance runs the wrong way.","fix":"Add: \"Bank's side: Debit is money out, Credit is money in.\"","checks":["r1"]},{"title":"Not giving the opening balance","why":"The AI starts at zero or points at the header row above.","fix":"Add: \"Start from the opening balance in $H$1.\"","checks":["r0"]},{"title":"Leaving the first row awkward","why":"The AI writes F1+D2-E2, which breaks on row 2 because F1 is a header.","fix":"Add: \"Expanding ranges from row 2, so one formula fills down.\"","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"]},{"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 10 words. Nothing else.\"","checks":["maxProseWords"]}],"promptHints":[{"label":"Says debit is money out","patterns":["money out","bank'?s (side|view)","subtract debits|debits? (are|is|mean)"]},{"label":"Gives the opening balance","patterns":["h1","opening"]},{"label":"Asks for one fill-down formula","patterns":["expanding","\\$d\\$2","fill down","same formula"]},{"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":"Debit and credit mean opposite things on a bank statement and in your books. Tell the AI which one this is, and where the opening balance lives.","rubricLabels":["Starts from the opening balance in $H$1 (locked)","Subtracts debits and adds credits, because on the bank's side Debit is money out (for example $H$1 - SUM($D$2:D2) + SUM($E$2:E2))","Uses expanding ranges anchored at row 2 ($D$2:D2 and $E$2:E2) so the same formula works filled down from F2, with no reference to F1"]}