Function Problems

How to Match Data Between Two Excel Worksheets (Formulas & VBA)

Jason MillerJason Miller Nov 2, 2026 871 views

Question details

The user needs to match records between two Excel worksheets using multiple criteria (like number, name, and class) to return corresponding assignment or score values.

How to Match Data Between Two Excel Worksheets
Product
Excel
Device & OS
not provided
Scenario
Comparing and extracting related data from a secondary worksheet based on matching specific identifiers.
Observed behavior
Successfully retrieving assignment or score values from a secondary sheet into the primary sheet when multiple conditions are met.
Before you start

Ensure both worksheets are in the same workbook for easier referencing, and verify that your matching columns (like names or IDs) have no leading or trailing spaces.

Solution 1Recommended

Use INDEX and MATCH for Multiple Criteria

This is the most robust method for matching data when you need to check two or more conditions (e.g., matching both Number and Name).

Using a combination of INDEX and MATCH allows Excel to evaluate multiple arrays and return a value only when all criteria are satisfied. This avoids the limitations of basic VLOOKUP.

1
Select the target cell

Click on the first empty cell in your target column on Sheet1 (e.g., C2).

2
Enter the multi-criteria formula

Type the formula: =IFERROR(INDEX(Sheet2!$C$2:$E$10000,MATCH(1,INDEX((Sheet2!$A$2:$A$100000=$A2)*(Sheet2!$B$2:$B$100000=$B2),,),0),COLUMN()-2),"NA")

3
Apply the formula

Press Enter to evaluate the array formula. If using older versions of Excel, you may need to press Ctrl+Shift+Enter.

4
Fill the data

Click and drag the fill handle at the bottom-right of the cell to the right, and then double-click it to fill the formula down your entire dataset.

Use INDEX and MATCH for Multiple Criteria
Adding more criteria: If you need to add a third criterion, such as 'Class', simply add another multiplied condition *(Sheet2!$C$2:$C$100000=$C2) inside the MATCH function's array argument.
Efficient Spreadsheet Management

Match Data Easily with WPS Spreadsheet

WPS Spreadsheet fully supports advanced array formulas like INDEX and MATCH, as well as VLOOKUP and XLOOKUP, allowing you to accurately cross-reference large datasets without lagging.

  1. 1. Open your file: Launch WPS Spreadsheet and open the workbook containing your datasets.
  2. 2. Select the target cell: Navigate to the exact cell where you want the matched data to appear.
  3. 3. Input the formula: Type your INDEX/MATCH or VLOOKUP formula exactly as you would in Excel.
  4. 4. Apply across rows: Press Enter, then drag the fill handle to seamlessly apply the matching logic across your rows.
Fully compatible with Microsoft Excel formulas and functions.Handles large datasets and multi-criteria arrays smoothly without freezing.Free and lightweight alternative to heavy spreadsheet software.Familiar user interface requires no learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

Why is my INDEX MATCH formula returning an #N/A error?

Common reasons include mismatched data types (e.g., numbers stored as text in one sheet but not the other), trailing spaces, or unequal array sizes in your formula. Double-check that your lookup ranges (like $A$2:$A$10000) are the exact same size.

Can I use XLOOKUP to match multiple criteria instead?

Yes, if your spreadsheet software supports it, you can use XLOOKUP by concatenating the lookup values and lookup arrays using the '&' symbol (e.g., XLOOKUP(A2&B2, Sheet2!A:A&Sheet2!B:B, Sheet2!C:C)), which is often easier to read than a complex INDEX MATCH.

How do I match data across two completely separate workbooks?

You can reference a different workbook by keeping both files open and clicking the target range in the external file while writing your formula. The formula will automatically include the external file name enclosed in square brackets.