Get help

Help center

Guides and answers

Contact support

Write to our team

Sign in to

Workflows

Build processes with your team

Automations

Connect files and automate tasks

One system, four parts

AI agents

Virtual Employees that work 24/7

Automations

Connect files and automate tasks

Workflows

Build processes with your team

Data Space

Trusted data sharing and control

Solutions by department

Finance

Reports, budgets, and reconciliations

Inventory and manufacturing

Stock, orders, and production in one view

HR

Timesheets, attendance, and reviews

Project management

Status and workload across projects

Sales and CRM

Leads and deals kept up to date

Education

Student records and school data

Finance

Turn manual finance work into reports that update themselves.

What Finance teams automate

  • Track payables and receivables
  • Build cash flow statements
  • Compare budget against actuals

Inventory and manufacturing

See stock levels and automate ordering.

What inventory and manufacturing teams automate

  • Track inventory across multiple sites
  • Connect sales, purchasing, and warehouse data
  • Link a barcode scanner to your sheet

HR

Run recruitment, attendance, and OKR tracking from your sheets.

What HR teams automate

  • Track recruitment and onboarding
  • Record team OKRs and results
  • Track check-ins, check-outs, and leave

Project management

Assign tasks and track hours without manual updates.

What project teams automate

  • Assign tasks and track status changes
  • Estimate effort and log hours worked
  • Track milestones across projects

Sales and CRM

Track leads and sales performance with automated reports.

What sales teams automate

  • Track and convert leads
  • Set sales goals and track team metrics
  • Monitor sales KPIs on dashboards

Education

Automate attendance, grades, and school purchasing.

What schools automate

  • Track attendance and notify parents
  • Record and compare class grades
  • Track inventory lent to students and staff

Find a use case

By department

How each team uses Sheetgo

By industry

How each industry uses Sheetgo

By company size

Small, medium-sized, or large

Learn

Blog

Guides and product news

Customer stories

How teams like yours use Sheetgo

Help center

Guides and answers

Why Sheetgo

Compare

How Sheetgo compares with other tools

Security

How we protect your data

Trust center

Our compliance details

Sign in to

Workflows

Build processes with your team

Automations

Connect files and automate tasks

One system, four parts

AI agents

Virtual Employees that work 24/7

Automations

Connect files and automate tasks

Workflows

Build processes with your team

Data Space

Trusted data sharing and control

Solutions by department

Finance

Reports, budgets, and reconciliations

Inventory and manufacturing

Stock, orders, and production in one view

HR

Timesheets, attendance, and reviews

Project management

Status and workload across projects

Sales and CRM

Leads and deals kept up to date

Education

Student records and school data

Find a use case

By department

How each team uses Sheetgo

By industry

How each industry uses Sheetgo

By company size

Small, medium-sized, or large

Get started

Templates

Ready-made workflows to start from

Learn

Blog

Guides and product news

Customer stories

How teams like yours use Sheetgo

Help center

Guides and answers

Why Sheetgo

Compare

How Sheetgo compares with other tools

Security

How we protect your data

Trust center

Our compliance details

Help center

Guides and answers

Contact support

Write to our team

Workflows

Build processes with your team

Automations

Connect files and automate tasks

How to use XLOOKUP in Google Sheets (with examples)

According to Exploding Topics, over 900 million people use Google Sheets monthly. But how many use XLOOKUP in Google Sheets?

This tutorial will show you how to use it to pull data from the same spreadsheet or two different spreadsheets.

It also covers the one job where FILTER works better than XLOOKUP: returning every match.

What is XLOOKUP in Google Sheets?

In simple terms, XLOOKUP helps you find specific information in your Google Sheets. You tell XLOOKUP what to look for (like a student’s grade) and where to look (which column in your gradebook). Then, it quickly finds the matching information and returns it to you.

XLOOKUP is a more flexible alternative to older functions like VLOOKUP and HLOOKUP.

XLOOKUP syntax and arguments

XLOOKUP takes six arguments. Only the first three are required.

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

Argument Required What it takes Default
search_key Yes The value to find: text, a number, or a cell reference None
lookup_range Yes The single row or column to search None
result_range Yes The rows or columns to return values from, as long as lookup_range None
missing_value No What to show when nothing matches #N/A
match_mode No 0 exact match, 1 exact or next larger, -1 exact or next smaller, 2 wildcard match 0
search_mode No 1 first to last, -1 last to first, 2 binary search on data sorted in ascending order, -2 binary search on data sorted in descending order 1

Excel names the same arguments lookup_value, lookup_array, return_array, and if_not_found, and some examples below use those names.

How to use XLOOKUP in Google Sheets: step by step

In this section, you will learn how to use XLOOKUP vertically to find an exact match using a single search key.

1. Open Google Sheets to the spreadsheet containing your table.

XLOOKUP in Google Sheets — sales table with id, name, email, product, amount and sales agent columns

2. Instead of typing the search key directly into the function, you can type it into a cell and later use the cell reference.

XLOOKUP in Google Sheets — last name Gabbetis typed as the search key next to the table

3. Type the XLOOKUP function and select the cell with the search key as the first parameter.

XLOOKUP in Google Sheets — formula started with cell I4 as the search key

4. For the second parameter, select the column where you want to find the search key.

XLOOKUP in Google Sheets — last_name column C:C selected as the lookup range

5. For the third parameter, select the column from which you want the result. Skip the optional parameters to get the defaults.

XLOOKUP in Google Sheets — email column D:D selected as the result range

6. Close the parenthesis and press ‘Enter’. You have your result.

XLOOKUP in Google Sheets — email address returned for the last name Gabbetis

How to use XLOOKUP from another sheet

Let’s say you are a teacher and use a Google Sheet to track your students’ grades. We will name the spreadsheet “Students Exams.”

Now, the spreadsheet has two sheets:

  • One called “Students” — It has the students’ names and ID numbers and
  • One called “Test Scores” — It has the students’ ID numbers and scores.

— Sheet 1: Students

XLOOKUP in Google Sheets — Students sheet with ID numbers, names and an empty Test Score column

— Sheet 2: Test Scores

XLOOKUP in Google Sheets — Test Scores sheet with ID numbers and scores

Keep in mind that these two sheets are in the same spreadsheet. We will show you how to use XLOOKUP in two separate spreadsheets later.

XLOOKUP in Google Sheets — Students and Test Scores tabs in the same spreadsheet

You want to see each student’s score next to their name in the “Students” sheet. Let’s choose John Doe. 

  1. In the cell under “Test Score” for John Doe, use this XLOOKUP formula:

=XLOOKUP(A2, 'Test Scores'!A:A, 'Test Scores'!B:B, "Not Found")

XLOOKUP in Google Sheets — formula that reads the Test Scores sheet typed in cell C2

Let’s break this formula down:

  • Lookup Value (A2): The ID number you’re looking for.
  • Lookup Array (‘Test Scores’!A:A): This is the column in the “Test Scores” sheet where the XLOOKUP function should find the ID numbers.
  • Return Array (‘Test Scores’!B:B): If it finds a match, it returns the corresponding value from the Return Array (the student’s score).
  • If Not Found (“Not Found”): If it doesn’t find a match, it displays “Not Found.”

In simple terms, this is what the formula says:

Find this student’s ID number on the Test Scores sheet. If you find it, tell me their score. If you don’t find it, just say ‘Not Found’.

2. Press “Enter” on your keyboard or click anywhere on your sheet. The score will appear.

XLOOKUP in Google Sheets — score 85 returned for John Doe

How do you use the XLOOKUP function in two separate Google Sheets?

Can you use the XLOOKUP function in two separate Google Sheets?

Yes. Wrap the lookup range and the result range in IMPORTRANGE so XLOOKUP reads them from the other file. The first time you connect the two files, Google Sheets asks you to allow access.

How does it work?

Use this formula:

=XLOOKUP(A2, IMPORTRANGE("https://docs.google.com/spreadsheets/d/sheet-id", "Sheet1!A:A"), IMPORTRANGE("https://docs.google.com/spreadsheets/d/sheet-id", "Sheet1!B:B"), "Not Found")

Let’s return to our teacher’s example.

Imagine you are collaborating with another teacher on a project. You each have your own Google Sheet containing student data.

Your Google Sheet is called “Students” and contains student names and ID numbers.

XLOOKUP between two spreadsheets in Google Sheets — your sheet with ID numbers and names

On the other hand, your colleague’s sheet is called “Test Scores” and contains student ID numbers and their scores on a recent test.

XLOOKUP between two spreadsheets in Google Sheets — colleague's sheet with ID numbers and scores

You want to combine this information into your “Students” sheet to see each student’s score next to their name.

How do you do this?

  1. Open your colleague’s sheet and copy the ID from the URL. It starts after ‘/d/’ and ends before the next “/.”
XLOOKUP between two spreadsheets in Google Sheets — spreadsheet ID highlighted in the Test Scores URL
  1. Replace the two “sheet-id” in the formula below with the ID you just copied.

=XLOOKUP(A2, IMPORTRANGE("https://docs.google.com/spreadsheets/d/15MmbjgdGPJ8VwJvYU4BY6GpDDqm59QEut-kQ65Z8er0", "Sheet1!A:A"), IMPORTRANGE("https://docs.google.com/spreadsheets/d/15MmbjgdGPJ8VwJvYU4BY6GpDDqm59QEut-kQ65Z8er0", "Sheet1!B:B"), "Not Found")

  1. Copy the name of the sheet from your colleague’s spreadsheet.
XLOOKUP between two spreadsheets in Google Sheets — Test Scores tab name at the bottom of the file

4. Replace the two “Sheet1” in the formula with your colleague’s sheet name, “Test Scores.” This is what your final formula will look like:

=XLOOKUP(A2, IMPORTRANGE("https://docs.google.com/spreadsheets/d/15MmbjgdGPJ8VwJvYU4BY6GpDDqm59QEut-kQ65Z8er0", "Test Scores!A:A"), IMPORTRANGE("https://docs.google.com/spreadsheets/d/15MmbjgdGPJ8VwJvYU4BY6GpDDqm59QEut-kQ65Z8er0", "Test Scores!B:B"), "Not Found")

5. In the cell under “Test Score” for Jane Smith, use the XLOOKUP formula above.

XLOOKUP between two spreadsheets in Google Sheets — XLOOKUP with IMPORTRANGE typed in cell C2

6. Press “Enter” on your keyboard or click anywhere on your sheet. The score will appear.

XLOOKUP between two spreadsheets in Google Sheets — score 85 returned for John Doe from the other file

7. If you want to get Jane Smith’s score in row 3, change "=XLOOKUP(A2" to "=XLOOKUP(A3."

XLOOKUP between two spreadsheets in Google Sheets — Jane Smith's ID 102 and score 78 highlighted

Old formula with (A2:

=XLOOKUP(A2, IMPORTRANGE("https://docs.google.com/spreadsheets/d/15MmbjgdGPJ8VwJvYU4BY6GpDDqm59QEut-kQ65Z8er0", "Test Scores!A:A"), IMPORTRANGE("https://docs.google.com/spreadsheets/d/15MmbjgdGPJ8VwJvYU4BY6GpDDqm59QEut-kQ65Z8er0", "Test Scores!B:B"), "Not Found")

New formula with (A3:

=XLOOKUP(A3, IMPORTRANGE("https://docs.google.com/spreadsheets/d/15MmbjgdGPJ8VwJvYU4BY6GpDDqm59QEut-kQ65Z8er0", "Test Scores!A:A"), IMPORTRANGE("https://docs.google.com/spreadsheets/d/15MmbjgdGPJ8VwJvYU4BY6GpDDqm59QEut-kQ65Z8er0", "Test Scores!B:B"), "Not Found")

XLOOKUP between two spreadsheets in Google Sheets — formula changed to A3 for Jane Smith in row 3

XLOOKUP examples in Google Sheets

Now that you know how to use XLOOKUP to find an exact match for a single value, it’s time to learn about different ways of using it. In the examples below, you will learn to use XLOOKUP to perform horizontal lookups, search using multiple criteria, return several columns at once, search using wildcards, and use named ranges. The last examples show a default value for missing matches, FILTER for returning every match, and how to find the last or the closest match.

Horizontal XLOOKUP (instead of HLOOKUP)

XLOOKUP also searches across a row, so you can use it instead of HLOOKUP. Follow the steps below to perform a horizontal lookup.

1. In an empty cell, type the XLOOKUP formula and add the search key as the first parameter. In this case, the search key will be the column header you want to match.

Horizontal XLOOKUP in Google Sheets — column header email used as the search key

2. For the second parameter, select the row where you want to find the search key. In this case, the headers are in row 1.

Horizontal XLOOKUP in Google Sheets — header row 1:1 selected as the lookup range

3. For the third parameter, specify the row from which you want the result. Skip the optional parameters to get the defaults.

Horizontal XLOOKUP in Google Sheets — row 15 selected as the result range

4. Close the parenthesis and press ‘Enter’ to get the result.

Horizontal XLOOKUP in Google Sheets — email from row 15 returned by the formula

XLOOKUP with multiple criteria

To search for multiple values using XLOOKUP, you can combine it with ARRAYFORMULA.

1. In an empty cell, type the XLOOKUP function.

XLOOKUP with multiple criteria in Google Sheets — formula typed next to the first and last name keys

2. For the first parameter, select the first search key, add an ampersand (&), and select the second search key.

XLOOKUP with multiple criteria in Google Sheets — search keys I14 and I15 joined with an ampersand

3. For the second parameter, type the ARRAYFORMULA function and select the columns where you want to find the search keys, joined by an ampersand (&).

XLOOKUP with multiple criteria in Google Sheets — ARRAYFORMULA joining the first and last name columns

4. For the third parameter, select the column from which you want the result returned.

XLOOKUP with multiple criteria in Google Sheets — amount column F:F selected as the result range

5. Close the parenthesis and press ‘Enter’ to get the result.

XLOOKUP with multiple criteria in Google Sheets — amount $1,590.52 returned for Inessa Hoyes

Return several columns with one XLOOKUP

To return several values from the matching row, such as the email, product, and amount, you can use the ARRAYFORMULA function. XLOOKUP still returns only the first match. To get every matching row, use FILTER, as shown further down.

1. In an empty cell, type the XLOOKUP function and add the search key as the first parameter.

XLOOKUP in Google Sheets — last name Possa used as the search key to return several columns

2. For the second parameter, select the column where you want to find the search key.

XLOOKUP in Google Sheets — last_name column picked as the lookup range for Possa

3. For the third parameter, add the ARRAYFORMULA function and select the columns from which you want the results.

XLOOKUP in Google Sheets — ARRAYFORMULA(D:F) used as the result range

4. Close both parentheses and press ‘Enter’ to see the results.

XLOOKUP in Google Sheets — email, product and amount returned in one row for Possa

XLOOKUP with wildcards

If you only have or remember bits and pieces of your search key, you can use wildcard characters to find a match.

  • * matches zero or more characters.
  • ? matches exactly one character.
  • ~ nullifies wildcard characters so you can search for them.

1. Type the partial search key into a cell for later reference.

XLOOKUP with wildcards in Google Sheets — partial search key bridge typed in a cell

2. In an empty cell, type the XLOOKUP function.

XLOOKUP with wildcards in Google Sheets — formula typed next to the partial search key

3. Add the wildcard and partial search key, as shown below. The wildcard character should be between quotation marks and joined to the partial search key using an ampersand (&).

XLOOKUP with wildcards in Google Sheets — asterisk joined to the partial search key with an ampersand

4. For the second parameter, select the column where you want to find the match.

XLOOKUP with wildcards in Google Sheets — last_name column C:C selected as the lookup range

5. For the third parameter, select the column from which you want to get the result.

XLOOKUP with wildcards in Google Sheets — email column D:D selected as the result range

6. Since you’re searching using a wildcard, you’ll need to specify that the fifth parameter is “2”. However, you don’t need to specify the fourth and sixth parameters if you want the default values.

XLOOKUP with wildcards in Google Sheets — match_mode 2 added and the matching email returned

XLOOKUP with named ranges

Finally, let’s see how you can use named ranges in XLOOKUP to make the process even easier.

1. Open the spreadsheet with your table and go to Data > Named ranges.

XLOOKUP with named ranges in Google Sheets — Named ranges in the Data menu

2. From the sidebar, click “Add a range”.

XLOOKUP with named ranges in Google Sheets — Add a range in the Named ranges sidebar

3. Select the column you want to name and type in the name. Click “Done”.

XLOOKUP with named ranges in Google Sheets — range B2:B1001 named first_name

4. Repeat steps 2 and 3 until you’ve named all the necessary columns.

XLOOKUP with named ranges in Google Sheets — named ranges listed for every column of the table

5. In an empty cell, type the XLOOKUP function and add the search key.

XLOOKUP with named ranges in Google Sheets — formula typed with the search key Rennick

6. For the second parameter, start typing the name of the column to search and select it from the dropdown.

XLOOKUP with named ranges in Google Sheets — last_name range suggested as the lookup range

7. For the third parameter, start typing the name of the column to return and select it like before.

XLOOKUP with named ranges in Google Sheets — amount range selected as the result range

8. Close the parenthesis and press ‘Enter’ to see the result.

XLOOKUP with named ranges in Google Sheets — amount $303.28 returned for Rennick

Show a default value when there’s no match

You can use XLOOKUP in Google Sheets to find missing values in a dataset by comparing two lists (e.g., a list of existing products and a list of new products).

Let’s look at an example.

You’re a sales manager tracking employee performance in one Google Sheet. You have:

  • Sheet 1 (Employee Data): Contains employee names and ID numbers.
XLOOKUP in Google Sheets — Employee Data sheet with employee names and IDs
  • Sheet 2: Contains employee ID numbers and their sales figures.
XLOOKUP in Google Sheets — Sales sheet with figures for employees 101, 103 and 105
XLOOKUP in Google Sheets — Consolidated sheet with blank sales for Jane Smith and Emily Brown

Keep in mind that these three sheets are in the same spreadsheet.

XLOOKUP in Google Sheets — Employee Data, Sales and Consolidated tabs in one spreadsheet
  1. Open Sheet 3 (“Consolidated” in our example).
  2. In cell C2 of Consolidated, enter the following XLOOKUP formula:

=XLOOKUP(B2, Sheet2!A:A, Sheet2!B:B, 0)

This formula will:

  1. Look for the Employee ID in B2 within the range of Employee IDs in Sheet 2 (Sheet2!A:A).
  2. If found, it will return the corresponding Sales Figure from Sheet 2 (Sheet2!B:B).
  3. If not found, it will return the value 0, indicating no sales.

Keep in mind that you need to edit the formula before using it. For example, my sheet is called “Sales,” not “Sheet2” and the “102” ID is in row B3, not B2. So, my new formula will be:

=XLOOKUP(B3, Sales!A:A, Sales!B:B, 0)

Use it in the cell and press Enter on your keyboard.

XLOOKUP in Google Sheets — 0 returned for Jane Smith, who has no sales figure

Return every match with FILTER

People often ask us if XLOOKUP can return multiple results in Google Sheets.

The best way to answer this question is through an example.

Let’s say you manage a small bookstore and keep track of your inventory in a Google Sheet. Your sheet has the following columns:

  • Book Title
  • Author
  • ISBN
  • Quantity in Stock
  • Price
XLOOKUP in Google Sheets — bookstore inventory with title, author, ISBN, stock and price columns

You want to find all the books a specific author wrote and their ISBNs and quantities in stock.

  1. Identify your lookup value. In this example, I will go for an author’s name since it’s the value I want to find: J.K. Rowling.
  2. Identify the lookup array, the column containing the author names: Author.
  3. Identify the return arrays, the columns you want to return data from:
    • ISBN
    • Quantity in Stock
  4. Create the XLOOKUP formula:

=ARRAYFORMULA(XLOOKUP(lookup_value, lookup_array, {return_array1, return_array2}, "", 0))

Remember that you need to edit this formula to match your scenario.

=ARRAYFORMULA(XLOOKUP("J.K. Rowling", B2:B100, {C2:C100, D2:D100}, "", 0))

5. Open your sheet and use your formula in an empty cell.

XLOOKUP in Google Sheets — ARRAYFORMULA with XLOOKUP for J.K. Rowling typed in cell F2

6. Press “Enter.” As you can see, XLOOKUP only returns the first matching book, although the formula checks every row.

XLOOKUP in Google Sheets — ISBN and stock of only the first J.K. Rowling book returned

Can XLOOKUP return every matching row in Google Sheets?

Not really. XLOOKUP typically returns a single match or the first match it finds. Unfortunately, it does not natively support returning multiple matches as FILTER does. So, in its standard form, XLOOKUP is unsuitable for pulling various rows.

Did you notice that I mentioned FILTER? How does it work?

  1. Change your formula to:

=ARRAYFORMULA(FILTER({C2:C100, D2:D100}, B2:B100 = "J.K. Rowling"))

XLOOKUP in Google Sheets — FILTER formula for J.K. Rowling typed in cell F2

8. Press “Enter.” And voilà, FILTER pulled data from multiple rows.

XLOOKUP in Google Sheets — FILTER returning the ISBN and stock of every J.K. Rowling book

Find the last match or the closest value

The last two arguments change how XLOOKUP searches. These examples use the sales table from the step-by-step section, where column F holds the amount and column G the sales agent.

To get the amount of the last sale in the list for Agent2, set search_mode to -1 so XLOOKUP searches from the bottom up:

=XLOOKUP("Agent2", G:G, F:F, "Not found", 0, -1)

To find the closest value instead of an exact one, set match_mode to -1 (next smaller) or 1 (next larger). Say K2:K5 holds sales thresholds and L2:L5 the commission rate for each. This formula returns the rate for the highest threshold that isn’t above the amount in F2:

=XLOOKUP(F2, K2:K5, L2:L5, , -1)

Neither formula needs sorted data. Only the binary search modes, 2 and -2, do.

XLOOKUP vs VLOOKUP: what’s the difference?

VLOOKUP searches vertically, from left to right, within a table (hence the “V”); the lookup value must be in the first column. XLOOKUP, however, is more flexible. It can search vertically and horizontally; you don’t need to specify a column index.

VLOOKUP can also only return values to the right of the lookup column, while XLOOKUP can return values from either side.

Here is the difference in terms of syntax:

VLOOKUP

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

XLOOKUP

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

Conclusion

As you have seen, the Google Sheets’ XLOOKUP function is more powerful than VLOOKUP and HLOOKUP, and easier to use than alternatives like INDEX & MATCH. You’ve reviewed the function and its syntax and now know how to use XLOOKUP to do vertical and horizontal lookups for a single exact match. You also know how to pull data from another sheet or another file, search with multiple criteria or wildcards, and return several columns at once. When a lookup comes up empty, missing_value gives you a default, and when you need every match, FILTER does what XLOOKUP can’t.

If you repeat the same lookups across several files every week, Sheetgo, an AI-powered data automation platform, can connect those spreadsheets and keep the combined data updated on a schedule, without IMPORTRANGE formulas to maintain.

You may also like…

google sheets features and formulas

Top 5 dynamic array formulas in Google Sheets 

Google Sheets has evolved beyond basic spreadsheets. With the introduction of dynamic array formulas, users can now manipulate and analyze...
google sheets features and formulas

Mastering the FILTER Formula: 4 Use Cases with Examples

The FILTER formula in Google Sheets is a versatile tool for extracting data that meets specific conditions. Unlike the QUERY formula,...
google sheets features and formulas

Unlocking the Power of SUMIF and SUMIFS in Google Sheets: 4 real-life use cases

The SUMIF and SUMIFS formulas in Google Sheets are indispensable tools for performing conditional summations. They simplify complex...