Function Problems

Count Nonblank Cells by Text in Another Column in WPS Spreadsheets

Khadija KhanKhadija Khan Nov 18, 2026 870 views

Question details

Count nonblank cells in column F when the corresponding cell in column E contains RN, EN, or AIN, and copy the formula across columns.

Count Nonblank Cells by Text in Another Column
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
A spreadsheet has text in column E and values in columns F onward. The user wants a count for each value column based on the text in column E.
Observed behavior
The desired count includes each nonblank cell once when its corresponding column E cell contains at least one of the specified text strings.
Before you start

Check that column E and the value columns cover the same rows, and decide whether the criteria must match the entire cell or can appear within longer text. Adjust the row limits in the formulas to fit your data.

Solution 1Recommended

Count cells containing any of the specified text strings

Use SUMPRODUCT to count each nonblank cell once, even if its corresponding text contains more than one criterion.

1
Select a result cell

In WPS Spreadsheets, click an empty cell where you want the count for column F.

2
Enter the formula

Type =SUMPRODUCT(--((ISNUMBER(SEARCH("RN",$E$1:$E$10))+ISNUMBER(SEARCH("EN",$E$1:$E$10))+ISNUMBER(SEARCH("AIN",$E$1:$E$10)))>0),--(F$1:F$10<>"")) and press Enter.

3
Copy across

Drag the result cell's fill handle to the right to count columns G, H, and I against the same column E criteria.

Count cells containing any of the specified text strings
How the references work: $E$1:$E$10 stays fixed when copied. F$1:F$10 keeps the row limits fixed but changes to G$1:G$10 and subsequent columns when copied across. SEARCH is not case-sensitive.
WPS Spreadsheets

Count matching nonblank cells in WPS Spreadsheets

Use SUMPRODUCT and SEARCH in WPS Spreadsheets to count nonblank cells based on text in another column, then copy the formula across your sheet.

  1. 1. Open your spreadsheet: Open WPS Spreadsheets and select the workbook containing your data.
  2. 2. Choose a result cell: Click an empty cell where you want to display the count for column F.
  3. 3. Enter the formula: Enter =SUMPRODUCT(--((ISNUMBER(SEARCH("RN",$E$1:$E$10))+ISNUMBER(SEARCH("EN",$E$1:$E$10))+ISNUMBER(SEARCH("AIN",$E$1:$E$10)))>0),--(F$1:F$10<>"")) and press Enter.
  4. 4. Count additional columns: Drag the result cell's fill handle to the right to apply the formula to columns G and beyond.
Count each qualifying row once even when its text contains multiple criteria.Keep the criteria range fixed while copying the formula across columns.Open and edit Microsoft Excel XLSX and XLS files.Use a familiar spreadsheet interface to enter and copy formulas.
QA img-9

Frequently Asked Questions

Does the COUNTIFS formula match text within a longer cell entry?

No. The criteria {"RN","AIN","EN"} match entire cell values. Use the SUMPRODUCT and SEARCH formula above to match those strings within longer text.

Why not just add wildcards to the COUNTIFS criteria?

Wildcard criteria such as "*RN*" can match text within a cell, but summing multiple COUNTIFS results can count the same row more than once if it contains multiple criteria. The SUMPRODUCT formula counts each qualifying row once.

How do I keep column E fixed when copying the formula?

Use $E$1:$E$10 for the criteria range. Use F$1:F$10 for the values so the column changes to G, H, and beyond when you drag the fill handle right.

How can I count more than 10 rows?

Change both ranges to cover the same rows. For example, replace $E$1:$E$10 and F$1:F$10 with $E$1:$E$100 and F$1:F$100.