Contact

XLOOKUP Function in Google Sheets: Formula, Examples & Troubleshooting

Lookup Intermediate Google Sheets

Learn the XLOOKUP formula in Google Sheets: return the aligned value for a searched key, with reproducible examples, expected answers and compatibility cautions.

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

Quick answer: XLOOKUP searches one row or column and returns aligned values from a result range. In the Sheets worksheet interface, matching defaults to exact, searching first to last, with #N/A for a missing match unless you supply a fallback.

Availability and version history

  • Introduced: Announced August 24, 2022, with extended rollout expected to finish by September 26, 2022. These are service rollout dates, not desktop release numbers. Google release announcement.
  • Availability: Documented in the rolling Google Sheets service; examples use the web spreadsheet workflow.
  • Checked: October 14, 2026; official XLOOKUP reference. Documentation check, not a new native test; existing example-verification notes retain their scope.

Syntax and original practice data

=XLOOKUP(search_key, lookup_range, result_range, [missing_value], [match_mode], [search_mode])

Square brackets mark optional arguments and are not typed. Examples use English function names and comma separators; review File → Settings → Locale when comparing punctuation-sensitive formulas. Enter the original data below in A1:F9, with the Row column used only as an explanatory label. Amount and Units are numbers; other fields are text. Keep outputs outside the input table.

Row A · Item B · Team C · Status D · Amount E · Units F · Agent
1 Item Team Status Amount Units Agent
2 Pen East Paid 120 12 Ana
3 Pad West Pending 75 5 Bo
4 Box East Paid 210 7 Ana
5 Tape North Paid 90 0 Cy
6 Folder West Paid 150 3 Bo
7 Pen East Pending 60 8 Dee
8 Pad West Paid 125 12 Ana
9 Box North Pending 80 4 Cy

Two original worked examples

=XLOOKUP("Pad",A2:A9,D2:D9,"Missing")
=XLOOKUP("Stapler",A2:A9,D2:D9,"Missing")

Expected results are 75 and Missing. The default first-to-last search finds the first Pad at row 3. No item is named Stapler, so its supplied missing-value fallback is returned.

A fallback for no match is not a blanket instruction to hide every error in source data. Do not assume it repairs an error stored in a successfully matched result cell, a wrongly sized range or an invalid formula.

Required dimensions and defaults

The lookup range must be a single row or column. The result range must align along that lookup dimension: eight lookup rows need eight result rows, although more than one result column can be returned.

Optional input Default Other documented choices
missing_value #N/A Explicit fallback value
match_mode 0, exact -1 exact or next smaller; 1 exact or next larger; 2 wildcard
search_mode 1, first to last -1 last to first; 2 ascending binary; -2 descending binary

The help page’s opening sentence broadly mentions a closest match, but the detailed syntax makes approximate matching conditional on match_mode. A missing key in default exact mode does not automatically select a neighboring value.

Google separately documents XLOOKUP for BigQuery, where search_mode is not supported. The six-argument formulas on this page are ordinary worksheet formulas, not BigQuery expressions.

Advanced example: first versus last matching order

=XLOOKUP("Pad",A2:A9,D2:D9,"Missing",0,1)
=XLOOKUP("Pad",A2:A9,D2:D9,"Missing",0,-1)

Expected amounts are 75 and 125. Reversing search direction chooses the last matching position in the current range order. It does not automatically mean “most recent” unless that order was deliberately established from a meaningful time field.

Neither result is the Pad total 200. Use SUMIF when the requirement is an aggregate rather than one selected record.

Advanced example: return the matched row of several fields

=XLOOKUP("Pad",A2:A9,D2:F9,"Missing",0,1)
=XLOOKUP("Pad",A2:A9,D2:F9,"Missing",0,-1)

The first has expected one-row output 75,5,Bo: Amount, Units and Agent from the first Pad. The second returns 125,12,Ana from the last Pad. Labels are explanatory and are not included as output headers.

The lookup and result ranges both span rows 2–9. Leave three adjacent output cells clear. A three-column result is supported by the documented entire-row return rule; it is not three separate independent searches.

A leftward scalar lookup is also straightforward: =XLOOKUP(210,D2:D9,A2:A9,"Missing") has expected result Box, because Amount 210 occurs uniquely at row 4 and the aligned Item lies to its left.

Advanced example: choose lower or upper thresholds

On a separate sheet enter boundaries 0,10,20,50 in A2:A5 and labels Starter,Standard,Plus,Bulk in B2:B5.

=XLOOKUP(35,A2:A5,B2:B5,"Missing",0)
=XLOOKUP(35,A2:A5,B2:B5,"Missing",-1)
=XLOOKUP(35,A2:A5,B2:B5,"Missing",1)

Expected results are Missing, Plus and Bulk. Exact mode finds no 35; next-smaller mode chooses 20; next-larger mode chooses 50. Exact query 20 returns Plus in all three modes.

Query -1 in next-smaller mode has no eligible boundary and returns Missing; query 75 in next-larger mode likewise returns Missing. These are direction-specific boundary rules, not a general nearest-distance search.

Advanced check: binary search requires the promised order

For the ascending table above:

=XLOOKUP(20,A2:A5,B2:B5,"Missing",0,2)

Expected result: Plus. For descending binary mode, create the corresponding reversed pairs 50/Bulk,20/Plus,10/Standard,0/Starter in D2:E5. =XLOOKUP(20,D2:D5,E2:E5,"Missing",0,-2) also has expected result Plus.

The source explicitly requires ascending sorting for mode 2 and descending sorting for -2. Do not claim binary-mode correctness for unsorted data, and do not infer its duplicate-tie choice from the explicit linear first/last modes.

Start by checking alignment, key types, optional argument positions and search direction. The wildcard mode is separately documented; it is not enabled merely by typing pattern characters while leaving match_mode at zero. Complete wildcard escaping, blank-result coercion and native error displays remain outside these numeric/text examples.

Use XMATCH when you need the position rather than the returned value, and INDEX for explicit row/column selection. The verified 2022 service rollout history above is retained; importing an older Excel file requires formula review inside Sheets, not a guessed installed Sheets version.

Product-specific verification

Related guides already published for this function: Microsoft Excel | LibreOffice Calc | Gnumeric | PlanMaker 2026 | ONLYOFFICE Spreadsheet Editor

A corresponding guide establishes separate documentation, not guaranteed identical defaults or file-conversion behavior. See the function comparison tool and editorial testing standards.

The full manuscript, original source table and all original formulas were reviewed on October 14, 2026. New outputs were independently modeled from explicit inputs. The previously approved availability/history section is retained exactly. No native Google Sheets execution or complete type/error matrix is claimed.