Function Problems

How to Count Cells Matching Any of Several Text Values in Excel

Adam DavisAdam Davis Nov 13, 2026 870 views

Question details

The user needs an Excel formula that checks a range such as E2:E266 for at least one of several specified text values and returns 1 if any is present, otherwise 0.

How to Count Cells Matching Any of Several Text Values in Excel
Product
WPS Office Excel
Device & OS
not provided
Scenario
A user is reviewing a data range and wants a single formula result indicating whether any values such as CLOSED, 2024, or SOMEDAY exist in the range.
Observed behavior
The formula should return 1 when at least one listed value appears in the range and 0 when none of the listed values are found.
Before you start

Make sure the range reference E2:E266 matches your actual data location, and enter the lookup text values in double quotes inside the array constant, separated by commas.

Solution 1Recommended

Use IF with SUMPRODUCT and COUNTIF for multiple text matches

Use this formula when you need one result cell to return 1 if any listed text value appears in a range and 0 otherwise.

The COUNTIF function normally accepts one criterion. By supplying an array constant with several text values, COUNTIF returns a count for each value.

SUMPRODUCT sums the individual counts, and the IF function converts that total into a simple 1 or 0 result.

1
Enter the formula in the result cell

Select the cell where you want the result, type =IF(SUMPRODUCT(COUNTIF(E2:E266,{"CLOSED","2024","SOMEDAY"}))>0,1,0), and press Enter.

Use IF with SUMPRODUCT and COUNTIF for multiple text matches
Formula returns 1 or 0: The formula returns 1 if any listed value appears in the range, and 0 if none of the listed values are found.
WPS Office formula support

Use WPS Office Excel to create a multi-text match formula

You can complete this task directly in WPS Office Excel. The formula uses the same COUNTIF and SUMPRODUCT functions available in Excel, so your workbook remains compatible and easy to maintain.

  1. 1. Open your workbook: Launch WPS Office and open the Excel file containing the range E2:E266 or your actual data.
  2. 2. Select the result cell: Click the cell where you want the 1 or 0 result to appear.
  3. 3. Enter the COUNTIF SUMPRODUCT formula: Type =IF(SUMPRODUCT(COUNTIF(E2:E266,{"CLOSED","2024","SOMEDAY"}))>0,1,0) and press Enter.
  4. 4. Verify the result: Check that the cell shows 1 when any of the listed values exists and 0 when none are present.
Free spreadsheet formulas in WPS OfficeSupports .xlsx and .xls files with format compatibilityFamiliar Excel-like ribbon and function namesLightweight and easy to use
microsoft office alternative - wps office

Frequently Asked Questions

Can this formula check more than three text values?

Yes. Add as many quoted values as needed inside the array constant, separated by commas, such as {"CLOSED","2024","SOMEDAY","OPEN"}.

Why does COUNTIF inside SUMPRODUCT return an array?

When you give COUNTIF multiple criteria in an array constant, COUNTIF returns a count for each criterion. SUMPRODUCT then sums those counts so IF can test whether the total is greater than 0.

Can I reference a cell range for the text values instead of typing them?

Yes, you can replace the array constant with a criteria range, for example =IF(SUMPRODUCT(COUNTIF(E2:E266,F1:F3))>0,1,0), but make sure your version supports array evaluation or enter it as an array formula if required.

Is the COUNTIF comparison case-sensitive?

No. COUNTIF treats text values as case-insensitive, so CLOSED, Closed, and closed are all counted the same.

What should I change if my data is in a different column or range?

Replace E2:E266 with your actual data range in the COUNTIF part of the formula. The rest of the formula can remain the same.