Yes. Google Sheets can join tables by matching a shared key, usually with XLOOKUP or VLOOKUP for one matching record and FILTER when a key can have multiple matches. Sheets does not have a built-in relational database command such as SQL JOIN, so the right approach depends on whether you want to add columns, return every matching row, or combine lists.
What joining tables means in Google Sheets
A join connects information in separate tables using a value both tables share. For example, an orders table might contain product codes and quantities, while a product table contains each code, its name, and its price. Joining them lets you add the name and price to each order row without retyping that information.
The shared value is called a key. It should identify the same thing in both tables: a product code, customer ID, or invoice number is generally safer than a person’s name, which may be spelled inconsistently or shared by different people. A join is different from stacking tables. A join adds related columns beside existing rows; stacking appends one table’s rows below another table’s rows.
Spreadsheet formulas usually perform a lookup for each row rather than creating a database-style join operation. That distinction matters when a key appears more than once: a lookup commonly returns one match, while a one-to-many relationship may require a formula that returns several rows.
Choose a method for the kind of match you need
- One matching row per key: Use XLOOKUP for a clear, flexible exact-match lookup, or VLOOKUP if you prefer a widely familiar method.
- Several matching rows: Use FILTER to return every row that meets a condition.
- Only keys that match: Use a lookup and filter out missing results, or build a separate filtered result.
- Tables in different spreadsheet files: Bring in the source range with IMPORTRANGE, then look it up.
- Append similar tables: Stack the ranges rather than looking for matching keys.
Before choosing, check whether the key is unique in the table being searched. If it is not, decide which matching row you want or whether you need all of them. A formula cannot infer which duplicate is the correct record.
Join a table with XLOOKUP
Suppose a sheet named Products has product codes in A2:A4, names in B2:B4, and prices in C2:C4. On an Orders sheet, each order’s product code is in A2. To return the product name in Orders!C2, use this formula:
With product codes in Orders!A2 and Products!A2:A4, and names in Products!B2:B4, enter this in Orders!C2. If A2 contains P-102 and that code’s name is Cable, the result is Cable.
=IFNA(XLOOKUP(A2,Products!A$2:A$4,Products!B$2:B$4),"Not found")
XLOOKUP searches the code range and returns the value from the corresponding position in the name range. It does not require the key to be the first column of a larger lookup range, unlike VLOOKUP. The dollar signs keep the source rows fixed if you copy the formula down. IFNA displays a useful message when there is no match instead of an #N/A error.
To bring in the price as well, place a similar formula in Orders!D2, changing the return range to Products!C$2:C$4. Copy the formulas down for the order rows. Keep the lookup and return ranges the same size; mismatched ranges can cause errors or unexpected results.
Use VLOOKUP when it suits the table layout
VLOOKUP is a straightforward option when the key is in the first column of the lookup range and the value to return is in a column to its right. Its final argument should be FALSE for an exact match in this example. Leaving that argument out can produce an approximate match, which is usually not what you want for IDs or codes.
With the order code in Orders!A2 and Products!A2:C4 arranged as code, name, then price, enter this in Orders!C2. If A2 is P-102 and the matching name in Products is Cable, the formula returns Cable.
=IFNA(VLOOKUP(A2,Products!A$2:C$4,2,FALSE),"Not found")
The number 2 tells VLOOKUP to return the second column of the selected range. To return the price from the third column, use 3 instead. If you add or rearrange columns, check that this index still points to the intended field. For a long list, copy the formula down and confirm that the lookup range remains fixed.
Return every matching row with FILTER
Some relationships are one-to-many. A customer may have several invoices, or one product may appear in many shipments. XLOOKUP and VLOOKUP return a single matching result, so they are not enough when you need every related record. FILTER can return all rows that satisfy a condition.
Suppose Shipments has product codes in column A and shipment dates and quantities in columns B:C. To return all shipment dates and quantities for the code in Orders!A2, place this formula in an empty area of the Orders sheet:
With the requested product code in Orders!A2, codes in Shipments!A2:A100, and the two fields to return in Shipments!B2:C100, this formula returns every matching date-and-quantity row. If no shipment matches, it displays No matches.
=IFNA(FILTER(Shipments!B$2:C$100,Shipments!A$2:A$100=A2),"No matches")
The results spill into cells below and to the right, so leave that area clear. If there are no matches, FILTER returns an error; IFNA handles that case. FILTER is useful for a one-to-many result, but it does not automatically place every order beside a single summary row. Decide how you want to present multiple matches before building the final layout.
Decide whether you need a left, inner, or full join
Database terminology can help describe the result you want, even though Sheets does not offer a menu for these join types. A left join keeps every row from the main table and adds matching details where available. A lookup formula copied down the main table behaves this way: unmatched keys remain present and can show “Not found.”
An inner join keeps only rows with a match in both tables. You can create this by identifying missing lookup results and excluding those rows from a separate output. A full join keeps all rows from both tables, including keys found on only one side. That generally takes extra formula work: you need to combine the key lists, remove duplicates, and then retrieve each table’s fields. For complicated or recurring full joins, a database or data-preparation tool may be a better fit.
Be precise about which table supplies the rows you must preserve. If your goal is to keep every order, the orders table should be the main table. If your goal is to list every product whether or not it has an order, start from the products list instead.
Prepare keys and troubleshoot incorrect results
Many join problems come from the keys, not the lookup formula. Two values can look alike but fail to match because one contains an extra space, uses a different type, or has a different spelling. Before joining, compare a few known examples from both tables and check for duplicate keys.
- Check spaces and hidden characters. A code with a trailing space is not identical to the same code without it. Clean source data consistently before relying on a match.
- Check number and text formats. The number 123 and the text value “123” may not behave as the same key in every operation. Standardize both tables to the same type.
- Look for duplicates. A single-result lookup may return one matching record even when the key appears more than once. Use FILTER if all matches matter, or resolve the duplicate records first.
- Check the source ranges. Confirm the lookup and return ranges cover the same records and that copied formulas still point to the correct columns.
- Handle missing matches deliberately. Decide whether a blank, a message, or an excluded row is appropriate. Hiding missing records can conceal a data-quality issue.
For example, a customer ID stored as text in one table and as a number in another can cause a lookup to miss a record that appears visually identical. Converting both columns consistently is safer than changing formulas repeatedly. When the source data is imported regularly, build cleaning into the import or preparation step so the same issue does not return each time.
Join data from another spreadsheet or combine lists
For a source table in another Google Sheets file, IMPORTRANGE can expose a range in the destination spreadsheet; a lookup can then use that imported data. The first connection between files may require you to allow access. Only grant access to files and people you trust, and remember that the destination file’s sharing settings matter too.
If the two tables have the same columns and you simply want one longer list, do not use a lookup. Put the rows together while retaining only one header row. For occasional work, copying and pasting may be simplest. For repeatable workflows, use a formula-based stack or a data import process, taking care that column order and data types agree.
For larger, recurring transformations or complex joins involving many tables, consider whether Sheets is still the right tool. A database such as BigQuery supports SQL joins; a dedicated data-preparation workflow can also be easier to audit and refresh. These options add setup and access considerations, so a small table that needs a simple lookup may be better kept in Sheets.
Frequently Asked Questions
Does Google Sheets have a JOIN function?
Sheets has a JOIN function for joining text values with a delimiter, but that is not a relational table join. To match rows across tables, use functions such as XLOOKUP, VLOOKUP, or FILTER.
Can Google Sheets join tables from two files?
Yes. IMPORTRANGE can bring a range from another spreadsheet into the file where you are working, after access is authorized. You can then use a lookup or filter against the imported data.
Why does my lookup return #N/A?
Usually the key was not found as an exact match, the ranges are wrong, or the two key columns differ in spaces, spelling, or data type. Check a specific failing key in both tables before changing the formula.
How do I return multiple matches instead of the first one?
Use FILTER with the key column as its condition and the columns you want as its return range. Make sure the cells where the results will spill are empty.
Is Google Sheets different from Excel for joining tables?
Both programs commonly use lookup formulas for matching records, but their function availability and menus can differ. This article’s formulas and directions are for Google Sheets in a web browser, not Excel’s Power Query merge workflow.
Related
- General in Excel: Find and Use the Number Format Setting
- Microsoft Access vs Excel: Which Tool Should You Use?
- Where Did Undo and Redo Go in Excel?
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Insert a Checkbox in Excel on Windows 7: Step-by-StepTo insert a checkbox in Excel on Windows 7, use the Form Controls option: enable the Developer tab,…
- Excel Shortcut Keys With Ctrl, Alt, and Shift ExplainedExcel has several useful shortcuts that combine Ctrl, Alt, and Shift, but there is no single shortcut that…
- Wedding Budget Spreadsheet: Track Every Cost in ExcelYes. Create a wedding budget spreadsheet in Excel by listing each expense, its estimated and actual cost, and…
- How to Delete Blank Rows at the End of an Excel SheetTo delete blank rows beneath your data in Excel for Microsoft 365 on Windows, find the last row…
- Excel Not Blank Symbol: What <> MeansIn Excel, the not-blank test usually uses the not-equal operator <> with an empty string: =A2<>"". If A2…
- Create a Budget in Google Sheets: A Practical GuideTo create a budget in Google Sheets, make a monthly table with spending categories, planned amounts, and actual…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.