Function · Lookup

Excel XLOOKUP function

The Excel XLOOKUP function finds a value and returns a matching cell, with a message when nothing matches. A state tax-rate example and the versions that have it.

Microsoft 365, Excel 2021, Excel 2024, and Excel for the web. Google Sheets has XLOOKUP. Excel 2016 and 2019 do not.

Syntax =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

XLOOKUP
=XLOOKUP(D2,A2:A6,B2:B6,"Add this state")

Arguments

NameRequiredWhat to pass
lookup_valueRequiredThe value to find.
lookup_arrayRequiredThe row or column to search. It does not have to be to the left of the result.
return_arrayRequiredThe row or column to return from. It must be the same length as lookup_array.
if_not_foundOptionalWhat to return when there is no match. If omitted, a miss is #N/A.
match_modeOptional0, the default, is an exact match. -1 and 1 are the next smaller or next larger item. 2 allows wildcards.
search_modeOptional1 searches first to last. -1 searches last to first. 2 and -2 are binary searches and require the lookup array to be sorted.

Examples

Texas statewide rate, with a message ready for a missing state

=XLOOKUP("TX",A2:A6,B2:B6,"Add this state")

Result 6.25%

=XLOOKUP(D2,A2:A6,B2:B6,"Add this state")D3
State rates
ABCD
1StateRateLookup
2CA7.25%TX
3FL6.00%6.25%
4MA6.25%
5NY4.00%
6TX6.25%
Statewide rates only, from the Tax Foundation table dated January 1, 2026. Local tax is often extra. This grid is a picture of the sheet, not a live calculator.

XLOOKUP separates the column you search from the column you return, so the answer can sit to the left of the key. The default is an exact match. You do not have to remember to pass FALSE, which is the mistake VLOOKUP invites. A fourth argument is the result when the key is missing. Looking up WY in the five-state table returns Add this state instead of #N/A.

The Texas result is the statewide 6.25% from the Tax Foundation table of January 1, 2026. It is not a city rate. The sales-tax LAMBDA is what you use once you already have the rate and only need it rounded to the cent.

Excel 2016 and 2019 do not have this function. A workbook that has to open there should keep VLOOKUP, or INDEX and MATCH. Binary search (search_mode 2 or -2) is faster on a long sorted list and wrong on an unsorted one. Leave search_mode out unless you have sorted the key on purpose. An https picture address in the return column is text. IMAGE places that picture in the cell.