Formualizer Docs

MATCH

Returns the relative position of a lookup value in a one-dimensional array.

MATCH supports exact and approximate modes and returns a 1-based position.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=MATCH(lookup_value, lookup_array, [match_type])

Arguments

ArgumentTypeRequiredDefault
lookup_valueanyRequired—
lookup_arrayany (range)Required—
match_typenumberOptional1

Remarks

  • match_type defaults to 1 (approximate, ascending).
  • match_type=0 performs exact matching and supports *, ?, and ~ wildcards for text.
  • Exact matching never selects a blank candidate. A blank lookup value retains numeric-zero semantics and can select a real numeric zero, but not blank, text, or boolean candidates.
  • match_type=1 looks for the largest value less than or equal to the lookup value.
  • match_type=-1 looks for the smallest value greater than or equal to the lookup value.

Error cases

  • Approximate modes require sorted data. MATCH detects unsorted input and returns #N/A, matching the same guard applied by VLOOKUP and HLOOKUP.
  • If no match is found, returns #N/A.

Examples

Find the position of an exact text match.

Formula =MATCH("Cy",{"Ana","Bo","Cy"},0)

Expected result 3

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Find the greatest sorted lookup value at or below the target.

Formula =MATCH(25,{10,20,30},1)

Expected result 2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Match the first item at the lower end of a sorted array.

Formula =MATCH(10,{10,20,30},1)

Expected result 1

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

A missing exact-match name has no position.

Formula =MATCH("Dee",{"Ana","Bo","Cy"},0)

Expected result #N/A

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Exact text match

Formula =MATCH("B",A1:A3,0)

Input cells
A
1"A"
2"B"
3"C"

Expected result 2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Approximate numeric match

Formula =MATCH(27,A1:A4,1)

Input cells
A
110
220
330
440

Expected result 2

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

Why does MATCH with match_type 1 or -1 return #N/A on unsorted data?

Approximate modes assume ordered lookup data; this implementation treats detected unsorted inputs as no valid match and returns #N/A.

When are wildcards interpreted in MATCH?

Wildcard patterns (*, ?, ~ escapes) are only applied in exact mode (match_type=0) for text lookup values.

Implementation

Engine source

On this page