How to Extract Matching Rows From Two Lists in Excel

📅 Jan 13, 2026 📝 Sarah Miller

Manually identifying and extracting matching rows from two disparate datasets is a tedious, error-prone chore that drains valuable analytical time. This bottleneck often occurs when reconciling standard funding sources, such as federal grants and corporate sponsorships, where financial administrators must cross-reference separate ledger sheets.

Fortunately, utilizing modern Excel formulas grants you instantaneous clarity and automated alignment of overlapping records. Note the stipulation: this efficient method requires Excel 365 to support dynamic array engines. For example, comparing matching recipient IDs from your "Q1 Grant Allocations" list against your "Master Payroll" ensures perfect compliance. Below, we will detail the exact formulas and steps to master this extraction.

How to Extract Matching Rows From Two Lists in Excel

In data analysis, comparing two lists and extracting the matching rows is one of the most common tasks you will encounter. Whether you are reconciling financial transactions, verifying active user accounts, or cross-referencing inventory across two warehouses, manual comparison is tedious and highly prone to error.

Fortunately, Excel offers several powerful ways to automate this process. Depending on your version of Excel and your specific data structure, you can use modern dynamic array formulas, classic lookup functions, or advanced data preparation tools like Power Query. This comprehensive guide will walk you through the best methods to extract matching rows from two lists in Excel.


Understanding the Scenario

Before diving into the formulas, let's establish a clear scenario. Imagine you have two lists of data on your worksheet:

  • List A (Master List): Columns A to C contain your master data (e.g., Employee ID, Name, and Department).
  • List B (Target List): Column E contains a list of specific Employee IDs that you want to search for in your Master List.

Your goal is to extract the complete rows (ID, Name, and Department) from List A for any Employee ID that also appears in List B.


Method 1: The Modern & Dynamic Way (Excel 365 & 2021)

If you are using Excel 365 or Excel 2021, you have access to dynamic array functions. The absolute best way to extract matching rows in these versions is by combining the FILTER and MATCH functions.

The Formula

=FILTER(A2:C10, ISNUMBER(MATCH(A2:A10, E2:E6, 0)), "No matches found")

How It Works Step-by-Step

This formula works from the inside out using logical evaluations:

  1. MATCH(A2:A10, E2:E6, 0): This function looks at every ID in the range A2:A10 and searches for it in your target list E2:E6. If it finds a match, it returns the position of the value as a number. If it does not find a match, it returns a #N/A error.
  2. ISNUMBER(...): This wraps around the MATCH function. It converts the numbers (successful matches) to TRUE and the errors (unmatched values) to FALSE. This creates an array of TRUE and FALSE values.
  3. FILTER(A2:C10, ...): The FILTER function takes your master dataset (A2:C10) and filters it, keeping only the rows where the corresponding value in our array is TRUE.
  4. "No matches found": This is an optional argument. If there are absolutely no matches between the two lists, Excel will display this text instead of throwing a #CALC! error.

Why this method is superior: It is fully dynamic. If you add, delete, or change values in your lists, the extracted results update instantly. Furthermore, because of Excel's "spill" behavior, you only need to write the formula in one single cell, and it will automatically populate the adjacent columns and rows.


Method 2: The Classic Way (Excel 2019 and Older)

If you are using an older version of Excel, you won't have access to the FILTER function. Instead, you can use a combination of INDEX, MATCH, and a helper column to pull matching rows without needing complex array formulas.

Step 1: Set Up a Helper Column

In your master list, insert a helper column (let's say Column D) next to your data. Enter the following formula in D2 and drag it down:

=IF(ISNUMBER(MATCH(A2, $E$2:$E$6, 0)), MAX($D$1:D1) + 1, "")

Note: Ensure that cell D1 is a text header or empty.

This formula assigns a sequential index number (1, 2, 3...) only to the rows that match List B. This simplifies the extraction process immensely.

Step 2: Extract the Matching Rows

Now, in your output area, you can extract the matching rows using INDEX and MATCH. In the cell where you want to display the first matched Employee ID, enter:

=IFERROR(INDEX(A$2:A$10, MATCH(ROWS($1:1), $D$2:$D$10, 0)), "")

Drag this formula across columns to pull the Name and Department, and then downward to pull all matching rows. Once the formula runs out of matches, the IFERROR function ensures that empty cells are displayed instead of ugly #N/A errors.


Method 3: Extracting Specific Fields Using XLOOKUP

Sometimes, you don't need to extract the entire row exactly as it is; you might just want to pull specific columns from your Master List based on the lookup keys in List B. In Excel 365, XLOOKUP is the cleanest tool for this.

Place this formula in the cell next to your target list (e.g., cell F2 next to E2) and copy it down:

=XLOOKUP(E2, $A$2:$A$10, $B$2:$C$10, "Not Found")

Why this is useful: Unlike classic VLOOKUP, XLOOKUP can return multiple columns at once (in this case, columns B and C) simply by referencing a multi-column range in the return array. It also defaults to an exact match, eliminating the need to type FALSE at the end of your formula.


Method 4: The Enterprise Solution - Power Query

When working with massive datasets (tens of thousands of rows or more), Excel formulas can lag and slow down your workbook. In these instances, Power Query is the most efficient and robust tool for extracting matching rows.

How to do an Inner Join in Power Query:

  1. Select your Master List (List A), go to the Data tab, and click From Table/Range. This opens the Power Query Editor. Close and load this query as a connection only (Home > Close & Load To... > Only Create Connection).
  2. Repeat this process for your Target List (List B), saving it as a connection only as well.
  3. Go to Data > Get Data > Combine Queries > Merge.
  4. In the Merge window:
    • Select your Master List query as the first table.
    • Select your Target List query as the second table.
    • Click on the matching ID column in both preview windows to link them.
  5. At the bottom of the window, change the Join Kind to Inner (only matching rows).
  6. Click OK. Power Query will filter your master dataset down to only the matching rows.
  7. Click Close & Load to output the matched list directly into a clean, new Excel table on your worksheet.

Power Query is highly repeatable. If your underlying data changes, you do not need to rewrite or re-drag formulas. You simply right-click the output table and click Refresh.


Comparing the Methods

Method Excel Version Best For Pros Cons
FILTER & MATCH 365 / 2021 Quick, dynamic extraction No helper columns; automatic spill; dynamic updates. Not backward compatible.
INDEX/MATCH (Helper) All Versions Legacy compatibility Works on any Excel version. Requires helper column; manual copying of formulas.
XLOOKUP 365 / 2021 Mapping specific fields Extremely simple syntax; returns multiple columns. Requires a lookup list structure.
Power Query 2010 and Newer Large files & repeat tasks Handles massive datasets; easy to update; keeps sheets clean. Requires manual refresh; slight learning curve.

Pro-Tip: Case-Sensitive Extraction

By default, standard Excel formulas (like MATCH, VLOOKUP, and XLOOKUP) are case-insensitive. If your data contains IDs where case matters (e.g., ID "abc" is different from "ABC"), you must adapt your formula to handle this.

To perform a case-sensitive extraction using FILTER, replace MATCH with the EXACT function:

=FILTER(A2:C10, BYROW(A2:A10, LAMBDA(row, OR(EXACT(row, E2:E6)))), "No Matches")

This utilizes Excel's modern lambda functions to enforce strict, exact character matching, preserving data integrity across case-sensitive codes.


Conclusion

Extracting matching rows between two lists does not have to be a painful manual process. If you are using Excel 365, leveraging the FILTER and MATCH array formula provides an elegant, automated, and dynamic workspace. For those on older Excel environments, the classic INDEX/MATCH method with helper columns keeps your sheets functioning perfectly. Finally, for large datasets, Power Query stands out as the ultimate option for speed and auditability.

Choose the method that matches your Excel version and data volume, and save yourself hours of manual data reconciliation today.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.