Formualizer Docs
ReferenceFunctionsLookup Functions

XLOOKUP

XLOOKUP: Looks up a value in one array and returns the aligned value from another array.

Summary

XLOOKUP supports exact, approximate, and wildcard matching with forward or reverse search.

Remarks

  • Defaults: match_mode=0 (exact), search_mode=1 (first-to-last).
  • if_not_found is optional; if omitted and no match exists, returns #N/A.
  • match_mode: 0 exact, -1 exact-or-next-smaller, 1 exact-or-next-larger, 2 wildcard.
  • search_mode: 1 forward, -1 reverse. Other modes are accepted with current fallback behavior.
  • lookup_array must be 1D. Invalid shape returns #VALUE!.
  • If return_array is multi-column or multi-row, the matched row/column is returned as a spill.

Examples

Exact key lookup with fallback
Grid
CellValue
Formula
=
Result
Not evaluated yet.
Expected
Bo
Return a full row from a matched key
Grid
CellValue
Formula
=
Result
Not evaluated yet.
Expected
[["West",140]]

FAQ

How do match_mode and search_mode interact?

match_mode controls exact/approximate/wildcard behavior, while search_mode controls scan direction; reverse search (-1) returns the last matching position.

What happens when no match is found?

If if_not_found is provided, XLOOKUP returns that value; otherwise it returns #N/A.

Why do I get #VALUE! from XLOOKUP on valid ranges?

The lookup_array must be one-dimensional (single row or single column); multi-row-and-column lookup ranges return #VALUE!.

Runtime metadata

Category

Lookup

Signature

XLOOKUP(arg1: Any, arg2: Range (Range), arg3: Range (Range), arg4?: Any, arg5?: Number, arg6?…: Number)

Arity

min 3, max variadic

Arguments

arg1

Any · Scalar

arg2by-ref

Range · Range

arg3by-ref

Range · Range

arg4optional

Any · Scalar

arg5optionaldefault

Number · Scalar · coercion NumberLenientText

arg6optionaldefault

Number · Scalar · coercion NumberLenientText

Caps

PURELOOKUP

Source

On this page