WorkbookLogic
FormulaFreeLookupbeginnerXLOOKUPCOUNTIFIF

Look Up a Value by Exact Key

By WorkbookLogic

Return an attribute from one unique identifier with XLOOKUP, using aligned bounded arrays, explicit exact matching, a controlled not-found result, and a separate uniqueness check.

ExcelLast reviewed Sep 11, 2026
xlookup-basic-exact-match-v1.0.0.xlsxFree
XLOOKUP Basic Exact Match, Formula Review
Compare exact matching, leftward returns, and controlled missing-key behavior.
Department mapping tableXLOOKUP review, editable keys
CodeDepartmentOwnerAnnual budget ($)Department keyD-104
D-101FinanceElena Ortiz$980,000Owner key for left lookupMaya Singh
D-102SalesLuis Romero$2,400,000
D-103OperationsPriya Shah$1,750,000ExampleFormula syntaxResult
D-104Customer SuccessMaya Singh$1,250,000Default exact match=XLOOKUP($I$11,$A$12:$A$19,$B$12:$B$19,"Not found")Customer Success
D-105ProductNoah Wilson$3,100,000Explicit exact budget=XLOOKUP($I$11,$A$12:$A$19,$D$12:$D$19,"Not found",0)$1,250,000
D-106EngineeringSofia Martin$4,200,000Leftward return=XLOOKUP($I$12,$C$12:$C$19,$A$12:$A$19,"Not found",0)D-104
D-107PeopleDaniel Kim$860,000Missing key fallback=XLOOKUP("D-999",$A$12:$A$19,$B$12:$B$19,"Not found",0)Not found
D-108LegalChloe Bernard$620,000
Reliability checks
Selected department code appears exactly onceOK
Looking the selected code up in the key column returns the same codeOK
Missing-key example returns the controlled fallbackOK

Overview

Return an attribute aligned with one selected identifier in a mapping table. The example uses a department code to retrieve its department name, owner, and annual budget while controlling missing and duplicate keys separately.

When to use it

Use it to map department, account, product, customer, or employee codes to assumptions and descriptive attributes. It suits exact identifiers where one source row should exist for each key.

When not to use it

Use INDEX and MATCH when XLOOKUP is unavailable. Use XMATCH when only a key’s position is required. Use a multiple-criteria lookup when one field does not uniquely identify the record. Large recurring mappings may belong in a governed transformation workflow.

Problem

Manual searches and nested IF chains are difficult to maintain as mappings change. A lookup can still return a plausible first result when duplicate keys exist, and an unhandled missing key creates #N/A. Both conditions require deliberate controls.

Inputs

Input

Location

Sample

Department code

Combined Example!I11

D-104

Source data

The synthetic mapping table in A12:D19 includes:

Code

Department

Owner

Annual budget

D-101

Finance

Elena Ortiz

$980,000

D-102

Sales

Luis Romero

$2,400,000

D-103

Operations

Priya Shah

$1,750,000

D-104

Customer Success

Maya Singh

$1,250,000

D-105

Product

Noah Wilson

$3,100,000

D-106

Engineering

Sofia Martin

$4,200,000

D-107

People

Daniel Kim

$860,000

D-108

Legal

Chloe Bernard

$620,000

Codes should be unique text values. Every return array must cover the same rows as the key array.

Calculations

  1. Read the selected department code.
  2. Search the bounded code array using exact match mode.
  3. Return the value from an aligned attribute array.
  4. Supply a clear not-found result.
  5. Count the selected key and require exactly one occurrence.

Outputs

For D-104, the workbook returns Customer Success, Maya Singh, and an annual budget of $1,250,000. The absent code D-999 returns Not found rather than an uncontrolled error.

Formula map

=XLOOKUP($I$11,$A$12:$A$19,$D$12:$D$19,"Not found",0)

I11 is the selected key, column A is the lookup array, and column D is the budget return array. "Not found" controls absence; 0 makes exact matching explicit. Change only the return array to retrieve another attribute.

Model checks

The workbook verifies that the selected code occurs exactly once, maps back to itself in the key column, and that missing code D-999 returns the intended fallback. All three checks return OK.

Edge cases

  • A missing key returns Not found.
  • Duplicate keys return the first match while the uniqueness check returns CHECK.
  • Leading or trailing spaces can prevent a text match.
  • Numeric and text versions of the same visible ID may not match.
  • Misaligned arrays return an error or the wrong attribute.
  • A valid blank return must remain distinguishable from an absent key.

Common errors

  • Using approximate matching for IDs: the wrong record may be returned. Require exact mode.
  • Ignoring duplicates: a plausible first result hides ambiguous master data. Keep COUNTIF validation.
  • Selecting different array sizes: rows stop corresponding. Align the boundaries.
  • Omitting a fallback: missing mappings become uncontrolled errors. Define the intended response.

Example

D-104 appears once in A12:A19, at the row containing Customer Success, Maya Singh, and $1,250,000. XLOOKUP returns each aligned field when its return array changes. Searching D-999 finds no row and returns the documented fallback.

Example workbook

Edit the cream key in Combined Example!I11 or the mapping rows in A12:D19. Three mapped outputs and controls update automatically. Formula Review compares default and explicit exact matches, a leftward return, and missing-key behavior.

Key takeaway

Use one unique exact key, aligned bounded arrays, and an intentional not-found result; a separate occurrence check protects the lookup from ambiguous duplicate source rows.