{"id":"code-work-fin-fix-fx-vlookup","audience":"finance","category":"coding","track":"coding","technique":"verification","title":"Fix a currency lookup that returns wrong rates","free":false,"task":"The FX rate formula in Invoices column D returns wrong rates and some #N/A errors. Last week the Rates table moved to columns D:E of the Rates sheet (codes in D, rates in E, rows 2-12), so the fix must point there. The controller wants errors to stay visible, so don't wrap it in IFERROR or IFNA. Give the fixed formula for D2 in one code block, then exactly 2 numbered lines naming what was wrong, under 40 words outside the code.","materialLabel":"The broken formula and what it shows (attached to your prompt automatically)","material":"INVOICES sheet (row 1 is headers)\nA Currency | B Amount | C Vendor | D FX rate | E USD amount\n\nFormula in D2, filled down to D300:\n=VLOOKUP(A2,Rates!A1:B12,2)\n\nWhat we see:\nRow 2: EUR, rate 1.27 (EUR should be 1.08)\nRow 3: GBP, rate 1.27 (correct)\nRow 4: JPY, rate 0.0067 (correct)\nRow 9: CAD, rate 0.73 (correct)\nRow 14: MXN, #N/A\nRow 15: EUR, #N/A\n\nRATES sheet (old layout, as of last month)\nA Code | B Rate\nGBP | 1.27\nUSD | 1\nEUR | 1.08\nJPY | 0.0067\nCAD | 0.73\nMXN | 0.055\n(rows 8-12: AUD, CHF, SEK, NOK, INR)\n\nNotes:\n- Column E is =B2*D2 and looks fine.\n- The rates are pasted from the bank's PDF on the 1st.\n- Vendor names in C are sometimes misspelled.","rules":[{"type":"codeBlocks","count":1},{"type":"numberedItems","count":2},{"type":"maxProseWords","max":40}],"mistakes":[{"title":"Not mentioning the move","why":"The AI can't know the rates table moved, so it fixes a formula that still points at the old columns.","fix":"Add: \"The Rates table is now in columns D:E, rows 2-12.\"","checks":["r1"]},{"title":"Accepting hidden errors","why":"The AI loves to wrap fixes in IFERROR, which hides problems the controller wants to see.","fix":"Add: \"Don't use IFERROR or IFNA; errors must stay visible.\"","checks":["r2"]},{"title":"Not asking for the causes","why":"The AI either fixes it silently or writes paragraphs about VLOOKUP.","fix":"Add: \"Then exactly 2 numbered lines naming what was wrong.\"","checks":["numberedItems","r0"]},{"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 12 words. Nothing else.\"","checks":["maxProseWords"]}],"promptHints":[{"label":"Mentions where the table moved","patterns":["d:e","columns? d","moved"]},{"label":"Keeps errors visible","patterns":["iferror","ifna","errors? (visible|show)"]},{"label":"Asks for the causes as a list","patterns":["(2|two) (numbered )?(lines|reasons|causes)","what was wrong","numbered"]},{"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":"Two things the AI can't know: the table moved, and the controller wants errors to show. Tell it both, then say how you want the explanation shaped.","rubricLabels":["The fixed formula asks for an exact match (FALSE or 0 as the fourth VLOOKUP argument, or MATCH with 0)","Looks up in the new location, Rates columns D and E (such as Rates!$D$2:$E$12 or Rates!D:E), with rows locked so filling down doesn't shift the range","Doesn't wrap the formula in IFERROR or IFNA"]}