Function Problems

Match Part of a Cell and Return Yes or No in WPS Spreadsheets

Khadija KhanKhadija Khan Nov 12, 2026 869 views

Question details

Find whether a value from one cell appears anywhere within cells in a column on another sheet, then return Y or N.

Match Part of a Cell and Return Yes or No in WPS Spreadsheets
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
The user needs to compare each value in a source column against text contained in a lookup column on another worksheet.
Observed behavior
The desired result is Y when the source value is found as part of any cell in the lookup range, and N when no matching text is found.
Before you start

Identify the source cell or table column that contains the value to search for and the target column on the other worksheet. Make sure the lookup range contains text values and replace the example sheet and column references with your own.

Solution 1Recommended

Use COUNTIF with wildcards to find text within another cell

Use this formula when the lookup value may be only part of a longer text string in the target column.

Asterisks (*) are wildcard characters in COUNTIF. Placing one before and after the lookup value searches for that value anywhere in each cell of the target range.

1
Select the result cell

Click the first cell where you want to display Y or N, such as C2 on your source worksheet.

2
Enter the partial-match formula

Type =IF(COUNTIF(Lookup!B:B,"*"&A2&"*")>0,"Y","N"), replacing Lookup!B:B with the column to search and A2 with the cell containing the value to find.

3
Fill the formula down

Press Enter, then drag the fill handle down the column or use Home > Fill > Down to apply the formula to the remaining rows.

Use COUNTIF with wildcards to find text within another cell
Partial-match result: The formula returns Y if A2 appears anywhere in at least one cell in Lookup column B; otherwise, it returns N.
Work with formulas in WPS Spreadsheets

Check Partial Text Matches with COUNTIF in WPS Spreadsheets

WPS Spreadsheets lets you use COUNTIF, IF, wildcard characters, and cross-sheet references to identify text contained within another cell and show an easy-to-read Y or N result.

  1. 1. Open the workbook in WPS Spreadsheets: Open your workbook and select the worksheet where the Y or N result should appear.
  2. 2. Choose the first result cell: Click the first blank cell in the result column, for example C2.
  3. 3. Add the wildcard COUNTIF formula: Enter =IF(COUNTIF(Lookup!B:B,"*"&A2&"*")>0,"Y","N") and update the sheet name, lookup range, and source cell as needed.
  4. 4. Fill the formula through the list: Press Enter and drag the fill handle down to evaluate every row.
Use COUNTIF wildcards to find a value anywhere within lookup text.Apply formulas down a column with fill tools for fast row-by-row checks.Open and edit Microsoft Excel .xlsx and .xls spreadsheets with formula compatibility.Use a familiar spreadsheet interface for cross-sheet references and table-based calculations.
microsoft office alternative - wps office

Frequently Asked Questions

What do the asterisks mean in a COUNTIF criterion?

In COUNTIF, * represents any number of characters. The criterion "*"&A2&"*" searches for the value in A2 at the beginning, middle, or end of a cell.

How can I return Yes and No instead of Y and N?

Change the last two arguments of IF. For example, use =IF(COUNTIF(Lookup!B:B,"*"&A2&"*")>0,"Yes","No").

Why does my formula return N even though the text looks the same?

Check that the formula points to the correct worksheet and column, and look for extra spaces or different characters in the source value. You can test the source cell with =TRIM(A2) if unwanted spaces are present.

Can I use this formula inside a spreadsheet table?

Yes. Use a current-row structured reference such as [@ColumnName] in place of A2: =IF(COUNTIF(Lookup!B:B,"*"&[@ColumnName]&"*")>0,"Y","N").

How do I check for an exact match rather than text contained within a cell?

Remove the wildcard characters and use =IF(COUNTIF(Lookup!B:B,A2)>0,"Y","N"). This returns Y only when a cell in the lookup range exactly matches A2.