Compare Values Across Sheets and Return Matching Data in WPS Spreadsheets
Question details
Compare two values on one sheet with a lookup column on another sheet and return the match and related data.

- Product
- WPS Spreadsheets
- Device & OS
- not provided
- Scenario
- Sheet1 columns B and C contain values to check against column A on Sheet2. The user wants a match indicator, the matching value, and related fields on Sheet1.
- Observed behavior
- Column E should show TRUE or FALSE, column F should show the matching value from Sheet2, and additional columns should display data from the matched row.
Confirm that the sheets are named Sheet1 and Sheet2 and that the lookup values are in Sheet2 column A. Identify which Sheet2 columns contain the related fields you want to return.
Use COUNTIF and INDEX MATCH to return cross-sheet matches
Use these formulas to check both values, show the matching value, and retrieve fields from the same row on Sheet2.
The formulas check B2 first, then C2. If both match, B2 takes priority; if Sheet2 contains duplicate lookup values, INDEX MATCH returns the first matching row.
In Sheet1 cell E2, enter =OR(AND(B2<>"",COUNTIF(Sheet2!$A:$A,B2)>0),AND(C2<>"",COUNTIF(Sheet2!$A:$A,C2)>0)). The result is TRUE if either nonblank value appears in Sheet2 column A.
In Sheet1 cell F2, enter =IF(E2,IF(AND(B2<>"",COUNTIF(Sheet2!$A:$A,B2)>0),B2,C2),""). This returns the matched value or leaves the cell blank if there is no match.
In Sheet1 cell G2, enter =IF($E2,INDEX(Sheet2!B:B,MATCH($F2,Sheet2!$A:$A,0)),""). This returns the value from Sheet2 column B on the matching row.
Select E2:G2 and drag the fill handle down for the remaining records. To return another field, copy G2 to H2 so the return range changes from Sheet2 column B to column C, then fill it down.

Match records across sheets with WPS Spreadsheets
Use COUNTIF and INDEX MATCH in WPS Spreadsheets to check two values against a lookup sheet and return related fields from the matching row.
- 1. Open your workbook: Open the workbook in WPS Spreadsheets and select the Sheet1 tab.
- 2. Add the match test: Select E2 and enter =OR(AND(B2<>"",COUNTIF(Sheet2!$A:$A,B2)>0),AND(C2<>"",COUNTIF(Sheet2!$A:$A,C2)>0)).
- 3. Return the matched value: Select F2 and enter =IF(E2,IF(AND(B2<>"",COUNTIF(Sheet2!$A:$A,B2)>0),B2,C2),"").
- 4. Return related data and fill down: Select G2 and enter =IF($E2,INDEX(Sheet2!B:B,MATCH($F2,Sheet2!$A:$A,0)),""). Select E2:G2 and drag the fill handle down.

Frequently Asked Questions
What happens if both B2 and C2 match values on Sheet2?
The formula in F2 returns B2 first. The related-field formula then retrieves data from the row matching B2.
How do I return a different field from Sheet2?
In the INDEX formula, replace Sheet2!B:B with the column containing the field you need, such as Sheet2!C:C. Keep MATCH pointed at Sheet2!$A:$A.
What if Sheet2 contains duplicate lookup values?
MATCH returns the position of the first matching value in Sheet2 column A, so the related field comes from that first matching row.
Why does a value that looks identical not match?
Check for extra spaces or a number stored as text in Sheet1 columns B and C or Sheet2 column A. Correct the values or standardize their format, then recalculate the formulas.




