Count Nonblank Cells by Text in Another Column in WPS Spreadsheets
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.

- 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.
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.
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.
In WPS Spreadsheets, click an empty cell where you want the count for column F.
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.
Drag the result cell's fill handle to the right to count columns G, H, and I against the same column E criteria.

Count exact text matches with COUNTIFS
Use a criteria array when column E cells must equal RN, EN, or AIN rather than contain those strings within longer text.
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. Open your spreadsheet: Open WPS Spreadsheets and select the workbook containing your data.
- 2. Choose a result cell: Click an empty cell where you want to display the count for column F.
- 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. Count additional columns: Drag the result cell's fill handle to the right to apply the formula to columns G and beyond.

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.




