Finance Operations

How to Verify AI-Generated Excel Formulas in Finance

Test an AI-generated Excel formula against duplicate references, currency differences and missing amounts, using a small fictional finance example.

Centaur CareersEditorial Team
Illustration of an analyst reviewing source data and reporting checks

Article summary

An AI-generated Excel formula should be reviewed as untrusted working code: understand the question, test known examples and examine exceptions before using the result. A formula that calculates successfully can still answer the wrong business question. This guide uses fictional records to show how an apparently reasonable lookup hides duplicate ambiguity, and how small visible checks make the conclusion easier to review.

Set up a reproducible fictional example

Use one worksheet. Put the headers Reference, Currency and Amount in A1:C1, and the four rows below in A2:C5. Put QueryReference, QueryCurrency and QueryAmount in G1:I1. Enter R202, USD and numeric 200 in G2:I2. All records are invented. Keep the source rows unchanged and use separate cells for calculations.

Fictional source cells A2:C5
Excel rowReferenceCurrencyAmount
2R201USD100
3R202USD200
4R202USD250
5R203EUR300

Why a plausible lookup gives the wrong conclusion

Consider this tempting formula: =IF(XLOOKUP(G2,$A$2:$A$5,$C$2:$C$5,"MISSING",0)=I2,"MATCH","REVIEW"). It returns MATCH for the supplied R202 query because the first matching reference has amount 200. It does not establish uniqueness or compare currency. Microsoft's XLOOKUP documentation explains the first-match behaviour; selecting a first row is not the same as resolving a duplicate.

Check Microsoft's XLOOKUP behaviour and supported versions

XLOOKUP is available in Microsoft 365 and newer perpetual Excel editions such as Excel 2021, but not in Excel 2016 or 2019. The exercises below use English function names and comma separators. Localised installations may use different names or separators. Before reusing any formula, confirm the workbook's version and input assumptions rather than asking an assistant to keep rewriting an unexplained error.

Make the checks visible in helper cells

Helper cells for the supplied query; copy the exact ranges
CellPurposeFormula
J2Candidate rows with this reference and currency=COUNTIFS($A$2:$A$5,G2,$B$2:$B$5,H2)
K2Candidate rows also agreeing on amount=COUNTIFS($A$2:$A$5,G2,$B$2:$B$5,H2,$C$2:$C$5,I2)
L2Candidate rows with a numeric source amount=SUMPRODUCT(($A$2:$A$5=G2)*($B$2:$B$5=H2)*ISNUMBER($C$2:$C$5))
M2Review unless the input and all three checks agree=IF(OR(G2="",H2="",I2="",NOT(ISNUMBER(I2))),"REVIEW",IF(AND(J2=1,K2=1,L2=1),"MATCH","REVIEW"))

For R202/USD/200, J2 is 2, K2 is 1 and L2 is 2, so M2 is REVIEW. The amount exists, but the candidate reference/currency is not unique. For R201/USD/100 the three checks are all 1, so the result is MATCH. Breaking the logic into cells lets a reviewer see which condition failed rather than trusting a large nested formula with no explanation.

Read Microsoft's COUNTIFS argument requirements

Read Microsoft's SUMPRODUCT function guidance

Test the edges, not only the happy path

Expected results using the original four source rows
QueryExpected M2Reason
R201 / USD / 100MATCHOne numeric source row agrees
R202 / USD / 200REVIEWTwo candidate rows; the first lookup hides ambiguity
R203 / USD / 300REVIEWSource currency is EUR
R999 / USD / 100REVIEWNo candidate reference
R201 / USD / blankREVIEWA missing amount is not confirmed zero
R201 / USD / text '100'REVIEWThe query amount is not numeric

As an additional test, temporarily change the R201 source amount to blank and query numeric zero; the numeric-source check must still force REVIEW. Restore the original input afterwards and retain the test record. The formula has a deliberately limited scope: plain alphanumeric identifiers, case-insensitive comparisons, exact amounts and no grouped settlement. Wildcard characters, case-sensitive keys, tolerances, date windows and one-to-many rules require a separately designed and tested method.

Document what you verified

Keep the prompt or problem statement, source version, proposed formula, test inputs, expected and observed outputs, changes and remaining limits. Do not upload customer records to an unapproved AI service. Treat any suggested correction as another version to test. A reviewer needs to understand the business meaning of the data as well as the spreadsheet syntax.

Review financial data-quality checks before matching

Choose between Excel, Python and AI by task

Explore financial modelling and valuation practice

Technical review: 28 October 2026. The displayed helper formulas and six query cases, plus the blank-source test, were evaluated in a separate unsaved Microsoft Excel workbook, version 16.0, build 20527. The weak lookup also reproduced its false MATCH. This is a bounded example, not a production reconciliation engine; edits to inputs or formulas require a fresh check.

ExcelAI VerificationData QualityFinance Skills

Next step

See how these topics fit the Financial Operations Masterclass

Compare the curriculum, learning options, published fees, certificate details, and current written support terms. Contact the team if you want help matching the program to your goal.