Contact

MATCH Function (Gnumeric)

Lookup Intermediate Gnumeric

Learn the MATCH function in Gnumeric: Defines a position in an array after comparing values.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

MATCH searches a single row or column and returns a one-based position. It returns neither the found value nor necessarily the worksheet row number. INDEX can use that position to retrieve data from another aligned range.

Syntax and matching modes

=MATCH(seek,vector[,type])

seek is the value to find, and vector is one row or one column. The optional type defaults to 1:

  • 0 finds the first exact match. Ordinary literal keys do not require sorted data.
  • 1 finds the largest value less than or equal to seek. Sort the vector ascending.
  • -1 finds the smallest value greater than or equal to seek. Sort the vector descending.

Specify 0 for ordinary identifiers. Omitting type selects approximate behavior. A two-dimensional search block is outside the vector contract and the documented result is #N/A.

Retained practice dataset

Enter the following without inserting a header into row 1:

Row A (Quantity) B (Amount) C (Category)
1 1 10 apple
2 2 20 pear
3 3 30 apple
4 4 40 pear
5 5 50 apple
=MATCH(30,B1:B5,0)
=MATCH(40,B1:B5,0)

Results are 3 and 4, the positions of the amounts. The returned 3 is not the amount 30. If the list began at B10, position 3 would be worksheet row 12.

Compare exact and approximate lookup

=MATCH(35,B1:B5,1) gives 3 because 30 is the largest listed value not exceeding 35. =MATCH(35,B1:B5) gives the same result under the default mode. =MATCH(35,B1:B5,0) gives #N/A because there is no exact 35.

For a separate descending list 50, 40, 30, 20, 10 in E1:E5, =MATCH(35,E1:E5,-1) is expected to give 2, corresponding to 40. This expectation follows from the documented mode and is not included among the native controls below.

An approximate search on unsorted values can return a plausible wrong position. Sort complete records consistently and verify the precondition rather than treating any numeric output as success.

Advanced use and duplicates

=INDEX(C1:C5,MATCH(40,B1:B5,0)) gives pear: MATCH identifies the fourth amount, and INDEX retrieves its fourth category. The ranges must cover the same records.

Exact lookup selects the first duplicate match. Validate uniqueness separately if duplicate keys represent different entities. In the inspected source, string searches containing *, ? or ~ take a pattern-matching path; literal identifiers containing those characters require deliberate escaping and separate controls. Executed examples here use numeric keys.

Troubleshooting

#N/A may mean a missing exact key, no eligible approximate boundary, or an invalid search shape. Inspect number-versus-text storage and stray spaces for failed text lookups. Do not replace every missing result with zero, because zero is not a valid one-based position.

Test the lookup by itself before nesting it. Approximate searches should include checks between keys as well as exact-key tests so the intended boundary rule is clear.

Availability and verification

Version coverage: Gnumeric 1.12.57 has the scoped checks below. The 1.12.62 evidence is a documentation/source check dated October 14, 2026.

  • Introduced: Original introduction not established. The earliest demonstrated support in this guide is 1.12.57.
  • Availability: Supported in Gnumeric 1.12.62, based on the function-specific registration.
  • Scope: Desktop; the fn-lookup function module must be included and enabled.
  • Checked: October 14, 2026. Documentation/source check; no new native test in Gnumeric 1.12.62.

The executable contract is also present in the official Gnumeric 1.12.57 fn-lookup source. The saved source was originally retrieved on October 17, 2026 and re-inspected for this guide. The last functioning release is not established; support in a named version is not a retirement claim.

On October 17, 2026, Gnumeric ssconvert 1.12.57 recalculated a synthetic workbook in the C.UTF-8 locale. Scoped controls: =MATCH(30,B1:B5,0) → 3; =MATCH(40,B1:B5,0) → 4; =MATCH(35,B1:B5,1) → 3; =MATCH(35,B1:B5,0) → #N/A; =MATCH(35,B1:B5) → 3. These are native calculation-engine results, not GUI tests or screenshots. Other tutorial layouts and displayed outputs are independent expectations unless covered by these exact formulas. Input/output files, preserved formulas, raw values and hashes were retained. The XLSX importer logged an unused workbookProtection-element warning; changed-input controls and recorded results were checked.

Official references