Skip to content

Why does XLOOKUP return one portrait file when my production ledger has two matching keys?

An exact XLOOKUP match does not prove that the lookup key is unique. The normal search begins at the first item and returns the corresponding first match; a reverse search can choose a different matching record. Before using the returned portrait filename or review version, check how many records legitimately match and decide what a duplicate means. Do not let row order become an unrecorded approval rule.

PRODUCTION LEDGER TOOLSAISwapLab team · Editorial methodPublished 3 min read
See the recorded exampleExplore 67 Image SkillsIndependent finishing · Check the actual file
Editorial workflow: Define one lookup key’s intended cardinality → Inspect match and search policy explicitly → Make ambiguity fail visibly before use.
Original editorial workflow diagram. It summarizes the guide's decisions; it is not a model output, interface screenshot or additional quality experiment.

Why does XLOOKUP return one portrait file when my production ledger has two matching keys?

The ledger is an external production aid. Its invented key fields are not promised AISwapLab API fields, and the sheet does not change the website’s selected replacement photos. This documentation-based procedure is unexecuted. The native decision is a scalar lookup’s treatment of multiple matches, not preservation of leading zeros, ordinary row sorting or a general source-to-person worksheet.

What to do next

  1. 01

    Define one lookup key’s intended cardinality

    Preserve the workbook and describe whether a key should identify one approved asset version, a family of versions or several role assignments. Inspect the source rows with that exact key before reviewing the lookup result. If revisions share a key, decide which additional version or approval component is required to identify one record. Do not delete duplicates automatically: two records can be legitimate history even though they are unsafe inputs for a formula expected to return one current assignment.

  2. 02

    Inspect match and search policy explicitly

    Review XLOOKUP’s match_mode and search_mode rather than assuming exact means unique. Microsoft documents exact matching as the default and first-to-last search as the default, with reverse search available. For the diagnostic fixture, inspect all source records for the key and compare the chosen result with the approved cardinality rule. A helper count such as =COUNTIF(A2:A4,E2) can flag multiple textual key occurrences in a simple fixture, but the team still needs to resolve whether those records represent valid distinct versions.

  3. 03

    Make ambiguity fail visibly before use

    Create two harmless rows with the same lookup key and different filenames, then inspect which one the proposed formula returns. Reverse their order in the duplicate and observe why a plausible filename is weak proof. Use an explicit ambiguity gate or a genuinely unique approved key before the result is used for a replacement assignment. Retain source history under its own policy. Do not hide a missing or duplicate match behind a default filename that could silently assign the wrong person.

A concrete example

Unexecuted fixture: A2:A4 contains k1, k1 and k2; B2:B4 contains portrait-old.jpg, portrait-approved.jpg and portrait-other.jpg. E2 contains k1. The proposed =XLOOKUP(E2,A2:A4,B2:B4,"Missing",0,1) returns the first exact match under its search policy, not a guarantee of approval. XLOOKUP is unavailable in Excel 2016 and 2019; verify the recipient’s edition before adopting this formula.

Production ledger native-contract worksheet

ContractProposed proofReject when
CardinalityInspect all matching source recordsExact matching is treated as uniqueness
SelectionUse different fixture filenamesRow order silently decides approval

Before you call it ready

  • Define whether each lookup key must identify exactly one record.
  • Inspect search order as well as exact matching.
  • Reject ambiguous assignments before using the returned filename.

When to stop or choose another method

Stop when duplicate meaning or version approval is unresolved. Keep both records and obtain the assignment owner’s decision. Choosing the last match merely because it looks newer is not a substitute for a documented version rule.

Sources

Review the result in context.

Compare the recorded example and its documented limitations.

See the recorded example