How to Check if Two Excel Columns Match a Row on Another Sheet
Question details
The user needs to determine whether a combination of values from two specific columns on one worksheet exists in the exact same row on a different worksheet.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Comparing data across multiple worksheets to find matching records based on two criteria columns instead of just one.
- Observed behavior
- The goal is to return a clear text result, such as 'Match' or 'Doesn't match', based on whether the combination of column A and B exists in the target sheet.
Ensure both worksheets are within the same workbook and that your data ranges do not contain extraneous leading or trailing spaces, as these can cause exact-match formulas to return false negatives.
Use the COUNTIFS Formula for Multiple Criteria Matching
The COUNTIFS function is the most efficient and readable way to check for matching pairs across sheets without requiring complex array formulas.
The COUNTIFS function allows you to count the number of times multiple conditions are met. By checking if the count is greater than zero, we can easily determine if a match exists.
Navigate to the first sheet (e.g., Sheet1) and click on the cell where you want the result to appear, such as cell C2.
Type the formula: =IF(COUNTIFS(Sheet2!$A$2:$A$10,A2,Sheet2!$B$2:$B$10,B2)>0,"Match","Doesn't match"). Adjust the ranges to fit your actual data.
Press Enter to see the result. Click on cell C2 again, grab the small square at the bottom-right corner (fill handle), and drag it down to apply the formula to the remaining rows.

Use the MATCH and IFERROR Array Formula
Alternatively, you can concatenate the two columns to perform an exact match lookup, which is a great fallback method for specific data structures.
Use WPS Spreadsheet to Compare Data Across Sheets Easily
WPS Spreadsheet is a powerful, free tool that fully supports advanced data lookup formulas like COUNTIFS, MATCH, and VLOOKUP. You can easily compare complex datasets, match multiple columns across sheets, and manage large workbooks without lags.
- 1. Download and Install: Download WPS Office for free from the official website and install it on your device.
- 2. Open your Workbook: Launch WPS Spreadsheet and open the file containing your multiple worksheets.
- 3. Enter the Formula: Select the target cell and enter your =COUNTIFS() formula to compare the two columns.
- 4. Drag to Fill: Use the fill handle to drag and apply the formula across all required rows instantly.

Frequently Asked Questions
Can I use VLOOKUP instead of COUNTIFS for matching two columns?
Standard VLOOKUP only searches based on a single criterion. To use VLOOKUP for two columns, you would first need to create a helper column on both sheets that concatenates the values (e.g., =A2&B2). Because of this extra step, COUNTIFS or INDEX/MATCH are generally preferred for multi-condition matching.
Why is my COUNTIFS formula returning 'Doesn't match' when the data clearly exists?
This usually happens due to subtle formatting issues, such as hidden trailing spaces or numbers formatted as text in one sheet but not the other. Use the TRIM() function on your data or check the cell formatting to ensure both sheets match exactly.
How do I highlight the matching rows instead of returning text?
You can use Conditional Formatting. Select your data range on Sheet1, go to Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter the formula: =COUNTIFS(Sheet2!$A$2:$A$10,$A2,Sheet2!$B$2:$B$10,$B2)>0. Then, choose a highlight color.




