Sub topic 10
Looking up values on another sheet
Assume you know how to enter formulas, use cell and range references, write absolute references such as $A$2:$C$100, and reference another sheet. In this chapter, you will connect an order sheet to a product catalog stored on a separate sheet in the same Google Sheets file.
How a cross-sheet lookup works
Suppose the Products sheet contains this data:
| A | B | C |
|---|---|---|
| Product ID | Product name | Price |
| P-101 | Notebook | 4.50 |
| P-102 | Desk lamp | 18.00 |
On an Orders sheet, cell A2 contains P-102. You want to display the matching price in C2.
A cross-sheet lookup has four parts:
- The key to search for, such as
A2. - The sheet and range containing the key.
- The column or range containing the result.
- The match rule, usually exact matching.
The exclamation mark separates a sheet name from its range. Products!A:A means column A on the Products sheet.
=XLOOKUP(A2, Products!A:A, Products!C:C, "Not found")This formula searches for the value in A2 in Products!A:A. It returns the value from the same row in Products!C:C. If the product ID does not exist, it displays Not found.
Using VLOOKUP across sheets
VLOOKUP places the lookup range and result column in one table range. The key must be in the first column of that range.
=VLOOKUP(A2, Products!A2:C100, 3, FALSE)This searches the first column of Products!A2:C100, which is column A on the Products sheet. The 3 tells Sheets to return the third column in that range, column C. FALSE requires an exact match.
Use absolute references when you copy the formula down and want the source range to stay fixed:
=VLOOKUP(A2, Products!$A$2:$C$100, 3, FALSE)The lookup key A2 remains relative, so it changes to A3, A4, and so on. The product table does not move.
Sheet names with spaces
A sheet name containing spaces or special characters needs single quotation marks:
=XLOOKUP(A2, 'Product Catalog'!A:A, 'Product Catalog'!C:C, "Not found")The quotation marks belong around the sheet name, not around the entire formula. If you rename the sheet through the Sheets interface, Google Sheets normally updates these references automatically.
Choosing the formula
| Task | Recommended formula | Reason |
|---|---|---|
| Return a value from a table to the right | `VLOOKUP` or `XLOOKUP` | Both can handle this |
| Use separate key and result ranges | `XLOOKUP` | The ranges are easier to read |
| Return a value to the left of the key | `XLOOKUP` | `VLOOKUP` cannot do this directly |
| Make a missing product readable | `XLOOKUP(..., "Not found")` | The fallback is built in |
XLOOKUP is usually clearer for new formulas because it does not use a numeric column index. If the product table changes by inserting a column, an XLOOKUP result range still points to the intended result column. A VLOOKUP column index can point to a different field after that change.
A practical cross-sheet pattern
For an order sheet with product IDs in column A and prices in column C, enter this in C2:
=XLOOKUP(A2, Products!A:A, Products!C:C, "Product ID not found")Copy it down for the order rows. If a row is blank, the formula may show the fallback message. To leave blank rows empty, test the key first:
=IF(A2="", "", XLOOKUP(A2, Products!A:A, Products!C:C, "Product ID not found"))Exercise
On the Orders sheet, cell A2 contains P-102. Product IDs are in Products!A:A and product names are in Products!B:B. Write a formula that returns the product name and displays "Missing" when no match exists.
Show answer
=XLOOKUP(A2, Products!A:A, Products!B:B, "Missing")